use proconio::input; fn main() { input! { n: i64 } let mut low = 0; let mut high = 100_000_000_000_000_000_i64; while high - low > 1 { let mid = (high + low) / 2; if check(mid) < n { low = mid; } else { high = mid; } } println!("{}", high); } fn check(mid: i64) -> i64 { if mid <= 2 { mid } else { (mid - 3) / 5 + 3 } }