#include <cstdio>
using namespace std;
int main()
{
    int n;
    while(scanf("%d",&n),n)
    {
        int ans=0;
        for(int i=0,tmp;i<n;i++)
        {
            scanf("%d",&tmp);
            ans+=tmp/100,tmp%=100;
            ans+=tmp/50,tmp%=50;
            ans+=tmp/10,tmp%=10;
            ans+=tmp/5,tmp%=5;
            ans+=tmp/2,tmp%=2;
            ans+=tmp;
        }
        printf("%d\n",ans);
    }
    return 0;
}
