L=int(input()) M=int(input()) N=int(input()) A=N%25 b=(M+(N//25)) B=b%4 c=(L+(b//4)) C=c%10 print(A+B+C)