l = int(input()) m = int(input()) n = int(input()) ans = n%25 + (n//25 + m)%4 + ((n//25 + m)//4 + l)%10 print(ans)