macro_rules! input { ($($x:ident : $t:ty), *) => { $(let $x: $t;)* { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); $($x = it.next().unwrap().parse().unwrap();)* assert!(it.next().is_none()); } }; } fn check(a: i64, b: i64) -> bool { if b == 0 { return false } return a * b / b != a } fn main() { input!(a: i64, b: i64, c: i64); let mut ok: i64 = c; let mut ng: i64 = 0; while ok - ng > 1 { let mid = (ok + ng) / 2; if check(b - 1, mid / a) { ok = mid; } else if (b-1)*(mid/a) >= c-mid { ok = mid; } else { ng = mid; } } println!("{}", ok); }