#include using namespace std; int main() { long long N, Ans = 0; cin >> N; vector Eratosthenes(100000, true); for (int i = 2; i < 100000; i++) { if (!Eratosthenes.at(i)) continue; for (int j = i * 2; j < 100000; j += i) Eratosthenes.at(j) = false; } for (int i = 2; i < 100000; i++) { if (!Eratosthenes.at(i)) continue; long long L = (long long)i * i; while (L <= N) { Ans += L; L *= i; } } cout << Ans << endl; }