#include using namespace std; typedef long long ll; ll solve(ll x){ ll x_copy = x; vector> c; for(ll i = 2; i * i <= x; i++){ int cnt = 0; while(x % i == 0){ cnt++; x /= i; } if(cnt) c.push_back({i, cnt}); } if(x > 1) c.push_back({x, 1}); reverse(c.begin(), c.end()); long long mul = 1ll; long long ans = 0ll; for(auto par : c){ while(par.second--){ ans += mul; mul *= par.first; } } return x_copy + ans; } int main(){ int n; scanf("%d", &n); ll ans = 0; while(n--){ ll x; scanf("%lld", &x); ans += solve(x); } printf("%lld\n", ans); return 0; }