L=int(input()) M=int(input()) N=int(input()) NM=N//25 ML=(M+NM)//4 NN=N%25 MM=(M+NM)%4 LL=(L+ML)%10 X=NN+MM+LL print(X)