n = int(input())
a = [300]
a += list(map(int,input().split()))
a += [0]
#print(a)

d = []
for i in range(1,len(a)-1):
  if a[i-1] > a[i] <= a[i+1]:
    d.append((a[i],-1))
  elif a[i-1] < a[i] >= a[i+1]:
    d.append((a[i],1))

m = 1000
k = 0
for x,y in d:
  c = m//x
  if y == -1:
    k += c
    m -= x*c
  else:
    m += k*x
    k = 0
  #print(x,y,m,k)
print(max(m,1000))
