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