f = input()
g = input()
h = input()
L = int(f)
M = int(g)
N = int(h)

a = 0
a += N % 25
M += N // 25
a += M % 4
L += M // 4
a += L % 10

print(a)