def ascan; gets.split.map(&:to_i); end a,B,c = ascan A = a*60 C = c*60*60 z = (1..(10**18)).bsearch{|x| A*x >= B*x+C} if z p z else p -1 end