import numpy as np
from scipy import signal

N = int(input())
A = list(map(int, input().split()))

f = True
while f:
  f = False
  for i in range(len(A)-1):
    if A[i] == A[i+1]:
      A.pop(i)
      f = True
      break
  if len(A) == 1:
    print(1000)
    exit()

B = np.array(A)
maxId = signal.argrelmax(B, mode='wrap')[0]
minId = signal.argrelmin(B, mode='wrap')[0]

money = 1000
kabu = 0
for i, b in enumerate(B):
  if i in maxId:
    money += kabu * b
    kabu = 0
  elif i in minId and max(maxId)>i:
    kabu += money // b
    money = money % b
print(money)