Fox Ciel is playing a game with numbers now. 

Ciel has *n* positive integers: *x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*n*</sub>. She can do the following operation as many times as needed: select two different indexes *i* and *j* such that *x*<sub class="lower-index">*i*</sub> &gt; *x*<sub class="lower-index">*j*</sub> hold, and then apply assignment *x*<sub class="lower-index">*i*</sub> = *x*<sub class="lower-index">*i*</sub> - *x*<sub class="lower-index">*j*</sub>. The goal is to make the sum of all numbers as small as possible.

Please help Ciel to find this minimal sum.
The first line contains an integer *n* (2 ≤ *n* ≤ 100). Then the second line contains *n* integers: *x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*n*</sub> (1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ 100).
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define v  vector<ll>
#define vv vector<vector<ll>>
#define vp vector<pair<ll,ll>>
#define append push_back
#define f(n) for(ll i=0;i<n;i++)
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b));}
void out(vector<ll> arr){ for(auto i:arr){cout<<i<<' ';}cout<<endl;}
void out(vector<pair<ll,ll>> par ){for(auto i: par){cout<<i.fir<<' ';}cout<<endl;for(auto i: par){cout<<i.second<<' ';}cout<<endl;}
void out(set<ll> arr){ for(auto i:arr){cout<<i<<' ';}cout<<endl;}
void inp(v & arr){f(arr.size()){cin>>arr[i];}}
void inp(ll & n){ cin>>n;}
void inp(ll & a,ll &b,ll &c){ cin>>a>>b>>c;}
void inp(ll & a,ll &b){ cin>>a>>b;}
void inp(ll & a,ll &b,ll &c,ll &d){ cin>>a>>b>>c>>d;}
int main(){
    ll n;
    cin>>n;
    v arr(n);
    inp(arr);
    ll ans = arr[0];
    f(n){
        ans = gcd(ans,arr[i]);
    }
    cout<<n*ans<<endl;
}