#include #include int p[1001]; int main(){ int i, j; int N; int sum = 0; p[0] = -1; p[1] = -1; for(i = 2; i < sqrt(1001); i++){ if(p[i] == -1) continue; for(j = 2; i * j < 1001; j++){ p[i * j] = -1; } } scanf("%d", &N); for(i = 2; i <= N; i++){ sum += p[i] == 0 ? i : 0; } printf("%d\n", sum); return 0; }