#include /* MACROS SAMPAH */ #define Jehian using #define Norman namespace #define Saviero std #define cepet {ios_base::sync_with_stdio(0);cin.tie(0);} Jehian Norman Saviero; /* MACROS FOR TYPE */ typedef long l; typedef long double ld; typedef long long ll; typedef unsigned long ul; typedef unsigned long long ull; typedef vector vi; typedef vector vl; typedef vector vll; typedef pair pi; typedef pair pl; typedef pair pll; typedef pair pld; /* MACROS FOR PRINT */ #define nl printf("\n"); #define sp printf(" "); /* MACROS FOR FUNCTION AND METHOD */ #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define mp make_pair #define eb emplace_back #define RESET(x) memset((x), 0, sizeof(x)) #define SET(x,y) for(int _je = sizeof(x)/sizeof(x[0]); _je--;) x[_je] = y #define SQR(x) (x)*(x) #define CUBE(x) SQR(x)*(x) /* MACROS FOR ATTRIBUTE */ #define fi first #define se second /* MACROS FOR SCAN */ #define scc(x) scanf("%c", &x) #define scd(x) scanf("%Lf", &x) #define scf(x) scanf("%f", &x) #define sci(x) scanf("%d", &x) #define scl(x) scanf("%ld", &x) #define scll(x) scanf("%lld", &x) #define scld(x) scanf("%Lf", &x) #define scui(x) sci(x) #define scul(x) scl(x) #define scull(x) scll(x) ll prima[1000005]; ll i, j; ll tmp; ll N; vll prime; ll res = 0; int main(){ SET(prima, 1); prima[0] = prima[1] = false; for (i = 2; i <= 1000000; ++i){ if (prima[i]){ prime.pb(i); for (j = 2; i*j <= 1000000; ++j){ prima[i*j] = false; } } } scll(N); for (i = 0; i < N; ++i){ scll(tmp); ll awal = tmp; for (j = 0; j < prime.size() && tmp > 1; ++j){ while (tmp % prime[j] == 0){ res += tmp; tmp /= prime[j]; } } if (tmp > 1){ res += tmp; tmp = 1; } res += tmp; } cout << res << endl; return 0; }