a,b,c=gets.split.map &:to_i d=60*a-b p d>0?(3600*c+d-1)/d:-1