fn main() { let mut x = String::new(); std::io::stdin().read_line(&mut x).ok(); let x: usize = x.trim().parse().unwrap(); let mut result = 0usize; let mut pos = 0usize; for _ in 0..100 { for &i in vec![0,0,1,1,0,1,1].iter() { if i == 0 { pos += 2; result += 2; } else { pos -= 1; result += 1; } if pos == x { println!("{}", result); return; } } } }