#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //#pragma comment(linker,"/STACK:102400000,102400000") bool isPrime[1001]; int MAIN() { memset(isPrime, true, sizeof(isPrime)); isPrime[1] = false; for(int i = 2; i <= 1000; i++) if(isPrime[i]) for(int j = i+i; j <= 1000; j+=i) isPrime[j] = false; int n; while(cin >> n) { long long s = 0; for(int i = 1; i <= n; i++) { int t; cin >> t; if(t <= 3 || isPrime[t]) s += t; } cout << s << endl; } return 0; } int main() { #ifdef LOCAL_TEST freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif ios :: sync_with_stdio(false); cout << fixed << setprecision(16); return MAIN(); }