#[macro_export] macro_rules! setup { { mut $input:ident: SplitWhitespace $(,)? } => { use std::io::Read; let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let mut $input = buf.split_whitespace(); }; } #[macro_export] macro_rules! parse_next { ($str_iter:expr) => { $str_iter.next().unwrap().parse().unwrap() }; } fn main() { setup! { mut input: SplitWhitespace }; let n: usize = parse_next!(input); macro_rules! is_multiple { ($i:expr, $p:expr) => { $i != $p && $i % $p == 0 }; } let mut ps = vec![]; for i in 2..=n { match i { i if is_multiple!(i, 2) => continue, i if is_multiple!(i, 3) => continue, i if is_multiple!(i, 5) => continue, i if is_multiple!(i, 7) => continue, i if is_multiple!(i, 11) => continue, i if is_multiple!(i, 13) => continue, i if is_multiple!(i, 17) => continue, i if is_multiple!(i, 19) => continue, i if is_multiple!(i, 23) => continue, i if is_multiple!(i, 29) => continue, i if is_multiple!(i, 31) => continue, i => ps.push(i), } } let ans: u64 = ps.into_iter().map(|p| p as u64).sum(); println!("{}", ans); }