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).
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

def gcd_arr(arr):
    arr.sort(reverse=True)
    g=gcd(l[0],l[1])
    for i in range(2,len(l)):
        g=gcd(g,l[i])
    return g

n=int(input())
l=list(map(int,input().split()))
print((gcd_arr(l))*len(l))

#explanation
#eg: 12  18
#calculating gcd
#1)18-->18-12=6
#2)12-->12-6=6
#3)6-->6-6=0
#4)gcd=6
#but in this problem we only subtract if i is strictly greater than j
#hence they both stop at step 2 as 6 is not greater than 6
# hence both these numbers are 6 and 6 and the sum is 12. (ie 2*gcd(18,12))