#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let n = read::(); let primes = get_primes(100200) .into_iter() .filter(|&x| x > 100000) .take(10) .collect::>(); let mut cands = vec![]; for i in 0..10 { for j in i..10 { cands.push(primes[i] * primes[j]); } } cands.sort(); cands = cands.into_iter().take(9).collect::>(); if n == 1 { println!("1"); } else { println!("{}", cands[n - 2]); } } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() } fn get_primes(n: i64) -> Vec { let mut is_prime = vec![true; n as usize + 1]; let mut primes = Vec::new(); is_prime[0] = false; is_prime[1] = false; for i in 2..n + 1 { if is_prime[i as usize] { primes.push(i); let mut j = 2 * i; while j < n { is_prime[j as usize] = false; j += i; } } } primes }