use std::io; fn main() { let mut n = String::new(); io::stdin().read_line(&mut n).ok(); let n: u64 = n.trim().parse().unwrap(); let mut ans: u64 = 0; for i in 0..n{ ans += power(i + 1, i % 3 + 1); } println!("{}", ans); } fn power(num: u64, repeat: u64) -> u64{ match repeat{ 0 => 1, 1 => num, _ => { let x = power(num, repeat / 2); if repeat %2 == 0{ x * x } else { x * x * num } } } }