N = int(input())
A = list(map(int, input().split()))
#Y = 1000
#N = 7
#A = [100, 130, 130, 130, 115, 115, 150]
#K = 0

def buy(i):
    global K,Y
    K += Y // A[i]
    Y -= K * A[i]

def sell(i):
    global K,Y
    Y += K * A[i]
    K = 0

# 初日は必ず買う
buy(0)
#print(i,K,Y)
#
for i in range(1,N-1):
    if A[i] < A[i+1]:
        buy(i)
    else:
        sell(i)
    #print(i,K,Y)
    
# 最終日は必ず売る
sell(N-1)
print(Y)