def ascan; gets.split.map(&:to_i); end a,B,c = ascan A = a*60 C = c*60*60 if A <= B p -1 else # Ax > Bx+C # C < (A-B)x # C/(A-B) < x z = (C+(A-B-1))/(A-B) p z <= 0 ? -1 : (C+(A-B-1))/(A-B) end