// yukicoder No.713 #include using namespace std; int main() { int n; cin >> n; int sum = 0; for (int i = 2; i <= n; ++i) { bool flag = true; int lim = sqrt(i); for (int j = 2; j <= lim; ++j) { if (i % j != 0) continue; else { flag = false; break; } } if (flag) sum += i; else continue; } cout << sum << "\n"; return 0; }