#include #include // iteration and input/output stream #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) #define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++) #define si(x) int x; scanf("%d", &x) #define sll(x) ll x; scanf("%lld", &x) #define pi(x) printf("%d", x) #define pll(x) printf("%lld", x) #define nl prinf("\n") #define tr(cont,it) \ for(typeof(cont.begin()) it = cont.begin(); it!= cont.end() ; it++) #define tc() int t; cin >> t ; while (t--) //STL shortcuts #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define F first #define S second #define MP make_pair // Error detection #define trace1(x) cerr<<#x<<": "< vi; typedef vector vvi; typedef vector vll; typedef pair pii; typedef pair pill; inline void smax(int &x , int y) { x = max(x , y) ; } inline void smin(int &x , int y) { x = min(x , y) ; } int main() { int n; cin>>n; ll v[n]; ll ans=0; rep(i,0,n) { cin>>v[i]; if(v[i]==1) { ans+=1; continue; } ll tmp=0; for(ll j=2;j*j<=v[i] ;j++) { if(v[i]%j==0) { tmp=j+1; v[i]/=j; break; } } if(tmp==0) { ans+= v[i]+1; continue; } for(ll j=tmp-1;j*j<=v[i]; j++) { if(v[i]%j==0) { tmp = j*tmp+1; v[i]/=j; j--; } //trace2(i,v[i]); } tmp = v[i]*tmp+1; ans+= tmp; } cout<