#include int main(void){ int a[5]; int sum=0; scanf("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]); for(int i=0;i<5;i++){ if(a[i]%3==0&&a[i]%5==0)sum=sum+8; else if(a[i]%3==0)sum=sum+4; else if(a[i]%5==0)sum=sum+4; else { if(a[i]/100>0)sum=sum+3; else if(a[i]-10>0)sum=sum+2; else if(a[i]==0); else { sum=sum+1; }}} printf("%d\n",sum); return 0; }