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 make_remlist(lst):
    temp_lst = list()
    for i in range(len(lst)-1):
        for j in range(i + 1, len(lst)):
            if(lst[j]%lst[i] == 0):
                temp_lst.append(lst[i])
            else:
                temp_lst.append(lst[j]%lst[i])
                
            if(lst[i]%lst[j] == 0):
                temp_lst.append(lst[j])
            else:
                temp_lst.append(lst[i]%lst[j])
    return temp_lst


def find_rem(arr, miN):
    for i in range(len(arr)):
        if(arr[i]%miN == 0):
            arr[i] = miN
        else:
            arr[i] = arr[i]%miN
    

n = int(input())
lst = list(map(int, input().split()))
lst2 = make_remlist(lst)
while(len(set(lst2)) != 1):
    min_val = min(lst2)
    find_rem(lst2, min_val)
print(lst2[0]*n)