text = input() L = int(text.split()[0]) M = int(text.split()[1]) N = int(text.split()[2]) M = M + int(N / 25) L = L + int(M / 4) print(L%10 + M%4 + N%25)