#include #include #include using namespace std; typedef long long ll; const int MAXN = 110; int _w; int n; ll solve( ll x ) { static ll a[MAXN]; static int m; m = 0; for( ll i = 2; i*i <= x; ++i ) if( x % i == 0 ) while( x % i == 0 ) a[m++] = i, x /= i; if( x != 1 ) a[m++] = x; sort(a, a+m); ll ans = 0, y = 1; for( int i = m-1; i >= 0; --i ) ans += y, y *= a[i]; return ans += y; } int main() { _w = scanf( "%d", &n ); ll ans = 0; while( n-- ) { ll x; _w = scanf( "%lld", &x ); ans += solve(x); } printf( "%lld\n", ans ); return 0; }