N = int(input())

value = list(map(int, input().split(' ')))

budget = 1000
             
buyDay = value.index(min(value))

sellDay = value.index(max(value))
             
if buyDay > sellDay:
  print(budget)
else:
  num = budget // value[buyDay]
  budget = budget - num * value[buyDay]
  print(budget + num * value[sellDay])