#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL<<60;
int main() {
  int N; cin>>N;
  vector<int> A(N);
  rep(i,N) cin>>A.at(i);
  vector<int> T;
  if(A.at(0)<A.at(1)) T.push_back(A.at(0));
  for(int i=1;i<N-1;i++){
    if(A.at(i)==A.at(i+1)) continue;
    if(A.at(i)>=A.at(i-1) && A.at(i)>A.at(i+1)) T.push_back(A.at(i));
    if(A.at(i)<=A.at(i-1) && A.at(i)<A.at(i+1)) T.push_back(A.at(i));
  }
  if(A.at(N-1)>=A.at(N-2)) T.push_back(A.at(N-1));
  int S=T.size();
  if(S>1&&T.at(S-1)<T.at(S-2)){
    T.pop_back();
    S--;
  }
  if(S<=1) cout<<1000;
  else{
    if(T.at(0)>T.at(1)){
      rep(i,S-1){
        T.at(i)=T.at(i+1);
      }
      T.pop_back();
      S--;
    }
    if(S<=1){
      cout<<1000;
      break;
    }
  pair<int64_t,int64_t> M(1000/T.at(0),1000%T.at(0));
    int i=1;
  while(i<S-1){
    auto a=M.first,b=M.second;//aが株の数、bが現金
    auto c=a*T.at(i)+b;
    if(a*T.at(i+2)+b < (c/T.at(i+1))*T.at(i+2)+c%T.at(i+1)){
      M.first=c/T.at(i+1);
      M.second=c%T.at(i+1);
    }
    i+=2;
  }
  cout<<M.second+M.first*T.at(S-1);
  }                             
}