n = 0 for i in [100,25,1]: n += i * int(raw_input()) cnt = 0 for i in [1000,100,25,1]: p = n/i if n/i > 0: n -= p*i if i<1000: cnt += p print cnt