#![allow(non_snake_case, unused_must_use, unused_imports)] use std::io::{self, prelude::*}; fn main() { let (stdin, stdout) = (io::read_to_string(io::stdin()).unwrap(), io::stdout()); let (mut stdin, mut buffer) = (stdin.split_whitespace(), io::BufWriter::new(stdout.lock())); macro_rules! input { ($t: tt, $n: expr) => { (0..$n).map(|_| input!($t)).collect::>() }; (Chars) => { input!(String).chars().collect::>() }; (Usize1) => { stdin.next().unwrap().parse::().unwrap() - 1 }; ($t: ty) => { stdin.next().unwrap().parse::<$t>().unwrap() }; } let A = input!(u128); let B = input!(u128); let f = |x| x * x * x - x * x + x + 1; let ans = (A..=B).filter(|&x| is_prime(x)).map(|x| f(x)).sum::(); writeln!(buffer, "{}", ans); } fn is_prime(x: u128) -> bool { if x == 1 { return false; } for i in 2..x { if x % i == 0 { return false; } } return true; }