#include #include using namespace std; int main () { vector A ; vector primes; long long int n = 10000000; int cont =0; for(long long int i = 0; i <=n; i++){ A.push_back(true); } A[0] = A[1] = false; for(long long int i = 2; i <=n; i++){ if(A[i]){ cont++; primes.push_back(i); for(long long int j = 2; j * i <=n; j++){ A[j*i] = false; } } } int T; scanf("%d", &T); long long int suma = 0; for(int i = 0; i < T; i++){ long long int len; scanf("%lld",&len); int j = 0; long long int sumap = 0; long long int copia = len; long long int ant = 0, primo_ant=0; while(len !=1 && j < cont){ if(len % primes[j] ==0){ while(len % primes[j]==0 && len !=1 ){ if(ant == 0){ ant = 1; } else{ ant = ant + primes[j]; } primo_ant= primes[j]; sumap += len/primes[j]; len = len /primes[j]; //printf("primo = %lld\n",primes[j]); //printf("len = %lld\n",len); } } j++; } if (len == copia && len !=1){ suma += len+1; } else if(len != 1){ suma += copia +sumap+1; } else{ suma += sumap + copia; } } printf("%lld",suma); return 0; }