N = int(input())
values = [int(s) for s in input().split()]
rest = 1000
for i in range(N):
  if rest >= 1000:
  	if values[i] >= values[i+1]:
    	have = values[i] // rest
	    rest = values[i] % rest
  elif value != 0:
    rest += values[i] * have
print(rest)