#include using namespace std; int f(int x) { return x * x * x - x * x + x + 1; } int main() { int A, B; cin >> A >> B; int ans = 0; for (int i = A; i <= B; i++) { bool isPrime = true; for (int j = 2; j <= min(7, i - 1); j++) { isPrime &= i % j != 0; } if (isPrime) { ans += f(i); } } cout << ans << endl; return 0; }