a,b,c,d,e,f;main(){scanf("%d%d%d",&a,&b,&c);d=(a/25);e=(b+d)/4;f=(c+e)/10;printf("%d",a-d*24+b+-e*3+c-f*10);}