use std::io::{stdin, Read}; fn main() { let mut buf = String::new(); stdin().read_to_string(&mut buf).unwrap(); let mut tok = buf.split_whitespace(); let mut get = || tok.next().unwrap(); macro_rules! get { ($t:ty) => (get().parse::<$t>().unwrap()); () => (get!(u64)); } let a = get!() * 60; let b = get!(); let c = get!() * 60 * 60; if a < b { println!("-1"); return; } // a*x < b*x + c (better manual) // x < c/(a-b) // x < ceil(c/(a-b)) // a*x >= b*x + c (better auto) // (a-b)*x >= c // x >= c/(a-b) // x > floor(c/(a-b)) let max = 1_000_000_000_000_000; let mut lp = 0; let mut rp = max; while lp < rp { let x = (lp + rp) / 2; let ax = a * x; let bxc = b * x + c; if ax < bxc { lp = x + 1; } else { rp = x; } } if rp < max { println!("{}", rp); } else { println!("-1"); } }