#include
main()
{
int n,s,i,m,q,p,t,r,y,j;
int a[10];//数组开小了,改为a[100]
while(scanf("%d",&j)!=EOF)
{
if(j==0) break;
s=0;
for(i=1;i<=j;i++)
{
scanf("%d",&a[i]);
m=a[i]/100;
a[i]=a[i] % 100;
n=a[i]/50;
a[i]=a[i] % 50;
q=a[i]/10;
a[i]=a[i] % 10;
p=a[i]/5;
a[i]=a[i] % 5;
t=a[i]/2;
a[i]=a[i] % 2;
r=a[i];
y=m+n+q+p+t+r;
s=s+y;
}
printf("%d\n",s);
}
return 0;
}