#include <bits/stdc++.h>
using namespace std;

int main() {
    #ifdef LOCAL
        freopen("a.in", "r", stdin);
        freopen("a.out", "w", stdout);
    #endif
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    long long ans = 0;

    for (int i = 1; i <= n; ++i) {
        long long a;
        cin >> a;

        long long curr = a;

        vector< long long > pr;
        for (long long j = 2; j * j <= a; ++j) {
            if (a % j)
                continue;
            while (a % j == 0) {
                pr.push_back(j);
                a /= j;
            }
        }

        if (a > 1)
            pr.push_back(a);

        sort(pr.begin(), pr.end());
        reverse(pr.begin(), pr.end());

        long long b = curr, nr = 1;
        for (auto it : pr) {
            curr += nr;
            nr = it * nr;
            b /= it;
        }

        ans += curr;
    }

    cout << ans << endl;

    return 0;
}

//Trust me, I'm the Doctor!