l = int(input()) m = int(input()) n = int(input()) a = n%25 b = (n//25 + m)%4 c = ((n//25 + m)//4 + l)%10 print(a+b+c)