#include"bits/stdc++.h" #define PB push_back #define PF push_front #define LB lower_bound #define UB upper_bound #define fr(x) freopen(x,"r",stdin) #define fw(x) freopen(x,"w",stdout) #define iout(x) printf("%d\n",x) #define lout(x) printf("%lld\n",x) #define REP(x,l,u) for(int x = (l);x<=(u);x++) #define RREP(x,l,u) for(int x = (l);x>=(u);x--) #define mst(x,a) memset(x,a,sizeof(x)) #define PII pair #define PLL pair #define MP make_pair #define se second #define fi first #define dbg(x) cout<<#x<<" = "<<(x)< inline void read(T &x){ x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f; } template inline void read(A&x,B&y){read(x);read(y);} template inline void read(A&x,B&y,C&z){read(x);read(y);read(z);} template inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);} template inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;} template inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;} int n; ll ans; int pri[maxn],vi[maxn],f[maxn],cnt; vector has; ll solve(ll x){ ll ans=x; has.clear(); for(int i=2;i<=1000000;i++)if(!vi[i]){ while(x%i==0){ has.PB(i); x/=i; } } if(x>1)has.PB(x); reverse(has.begin(),has.end()); ll now=1; for(auto i:has){ ans+=now; now*=i; } return ans; } void Work(){ read(n); REP(i,1,n){ ll x;read(x); ans+=solve(x); } cout<