#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "string" #include "map" #include "unordered_map" #include "iomanip" #include "cmath" using namespace std; const long long int MOD = 1000000007; long long int N, M, K, H, W, L, R; list Prime(int num) { listP; for (int i = 5; i <= num; i += 6) { bool flag = true; for (auto j : P) { if (j*j > i) { break; } if (i%j == 0) { flag = false; break; } } if (flag)P.push_back(i); flag = true; for (auto j : P) { if (j*j > i + 2) { break; } if ((i + 2) % j == 0) { flag = false; break; } } if (flag)P.push_back(i + 2); } P.push_front(3); P.push_front(2); return P; } int main() { ios::sync_with_stdio(false); cin.tie(0); auto P = Prime(1000000); long long int ans = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> M; listbox; for (auto j : P) { while (M%j == 0) { M /= j; box.push_front(j); } } if (M > 1) { box.push_front(M); } long long int num = 1; for (auto j : box) { ans += num; num *= j; } ans += num; } cout << ans << endl; return 0; }