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 findMaxSubarraySum(arr, n, sum):
	curr_sum = arr[0]
	max_sum = 0
	start = 0
	for i in range(1, n):
		if (curr_sum <= sum):
			max_sum = max(max_sum, curr_sum)
		while (curr_sum + arr[i] > sum and start < i):
			curr_sum -= arr[start]
			start += 1
		curr_sum += arr[i]
	if (curr_sum <= sum):
		max_sum = max(max_sum, curr_sum)
	return max_sum

n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
l = l[::-1]
while l.count(l[0]) != n:
    for i in range(n):
        l[i] -= findMaxSubarraySum(l, n, l[i]-1)
print(sum(l))