k=0 #1000yen l=int(input()) #100yen m=int(input()) #25yen n=int(input()) #1yen m+=int(n/25) n-=25*int(n/25) l+=int(m/4) m-=4*int(m/4) k+=int(l/10) l-=10*int(l/10) coin=l+m+n print(coin)