#include using namespace std; int main() { int n, i, j; int ans = 0; cin >> n; for (i = 2; i <= n; i++) { for (j = 2; j * j <= i; j++) { if (i % j == 0) break; } if (j * j > i) ans += i; } cout << ans << endl; return 0; }