fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let val = "285714".chars().collect::>(); println!("{}", val[(n-1) % 6]); }