#include using namespace std; // Function to check if a number is prime bool isPrime(int n) { if (n < 2) return false; for (int i = 2; i*i <= n; i++) { if (n % i == 0) return false; } return true; } // Function f(x) = x^3 - x^2 + x + 1 int f(int x) { return x*x*x - x*x + x + 1; } int main() { int A, B; cin >> A >> B; int sum = 0; for (int x = A; x <= B; x++) { if (isPrime(x)) { sum += f(x); } } cout << sum << "\n"; // End with a newline return 0; }