if __name__ == "__main__":
  maxind = 0
  minind = 0
  n = int(input())
  sp = list(map(int,input().split()))
  mxp = 0
  msf = sp[0]
  for i in range(1,n):
    d = sp[i] - msf;
    if (d > mxp):
      mxp = d
      maxind = i
    if(sp[i] < msf):
      msf = sp[i]
      minind = i
  a = 1000%sp[minind]
  b = 1000//sp[minind]
  a=a+b*sp[maxind]
  if(1000 < a):
    print(a)
    exit()
  else:
    print("1000")