L = int(input()) #100 M = int(input()) #25 N = int(input()) #1 n = N // 25 N = N - (n * 25) m = 25 * (M + n) // 100 M = M + n - (m * 4) l = (L + m) * 100 // 1000 L = L + m - (l * 10) print(N + M + L)