L = int(input()) M = int(input()) N = int(input()) n = N % 25 m = (M + N // 25) % 4 l = (L + (M + N // 25) // 4) % 10 print(n + m + l)