#include using namespace std; bool isPrime( long long x ) { if( x < 2 ) return false; if( x == 2 ) return true; if( x % 2 == 0 ) return false; for( long long i = 3; i * i <= x; i += 2 ) { if( x % i == 0 ) return false; } return true; } int main() { int N; cin >> N; int ans = 0; for( int n = 1; n <= N; n++ ) { if( isPrime( n ) == false ) continue; ans += n; } cout << ans << endl; }