L =int(input()) M = int(input()) N = int(input()) N1 = N % 25 M1 = (M + N//25)%4 L1 = (L + M//4)%10 print(L1 + M1 + N1)