l,m,n=3.times.map{gets.to_i} sum=100*l+25*m+n sum%=1000 ans=0 [100,25,1].each{|c| ans+=sum/c sum%=c } p ans