L = int(input()) M = int(input()) H = int(input()) h = H // 25 M += h m = M // 4 L += m l = L // 10 count = H - h * 25 + M - m * 4 + L - l * 10 print(count)