fn main() { let mut k = String::new(); std::io::stdin().read_line(&mut k).ok(); let k: usize = k.trim().parse().unwrap(); if k == 0 { println!("2 0"); return; } let n = format!("{:b}", k).len() + 2; let cnts = (0..=32).map(|i| if i < 1 { 0 } else { 1usize << (i-1) }).collect::>(); let mut lines = vec![(n-1, n)]; for width in 1..n-1 { for start in 1.. { let end = start + width; if end > n-1 { break; } lines.push((start, end)); } } for i in 0..format!("{:b}", k).len()-1 { if ((k >> i) & 1) == 1 { lines.push((n-(n-1-i), n)); } } println!("{} {}", n, lines.len()); for &(l, r) in lines.iter() { println!("{} {}", l, r); } }