#include using namespace std; #include using namespace atcoder; using mint = atcoder::modint998244353; // using mint = double; #define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++) #define ll long long #define ld long double #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define siz(x) (int)(x).size() template bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } const int inf = 1e9; const ll INF = 4e18; template using pq = priority_queue, less>; template using spq = priority_queue, greater>; vector di = {0, 0, 1, -1}; vector dj = {1, -1, 0, 0}; struct Edge { int to, cost; }; //エラトステネスの篩による [1, N] の素数判定 vector primeSieve(int N) { vector isPrime(N+1, true); isPrime[0] = isPrime[1] = false; for (int i = 2; i <= N; i++) { if (isPrime[i]) { for (int j = 2*i; j <= N; j += i) isPrime[j] = false; } } return isPrime; } void solve() { ll N; cin >> N; int M = 100050; vector isprime = primeSieve(M); vector ans; rep(i, 1, M+1) { if (!isprime[i]) continue; ll now = (ll)i * i; while(now <= N) { ans.push_back(now); now *= i; } } sort(all(ans)); ans.erase(unique(all(ans)), ans.end()); ll sum = 0; for (ll x : ans) sum += x; cout << sum << endl; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int T = 1; // cin >> T; while(T--) { solve(); } }