#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {

int n; cin>>n;
  vector<int>a(n);
  rep(i,n){cin>>a.at(i);}
   vector<int>b(n-1);
  rep(i,n-1){if(a.at(i+1)>=a.at(i))b.at(i)=1;
             else{b.at(i)=0;}}
   vector<int>c(n-1);
  
  
  
  rep(j,n-2){
   if(b.at(j)!=b.at(j+1)&&b.at(j)==1){c.at(j)=9;}
   else if(b.at(j)!=b.at(j+1)&&b.at(j)==0){c.at(j)=8;}
  }
   if(b.at(n-2)==1){c.at(n-2)=9;}  else{c.at(n-2)=8;}
  
  rep(i,n-1){if(b.at(i)==1){c.at(i)=7;break;}}
  
  int ans=1000; int kabu=0; int max=0; 
  
  if(n==2){
    if(b.at(0)==1){max=1000%a.at(0)+a.at(1)*(1000/a.at(0));}
    else {max=1000}
                  }
  else{
  
  rep(i,n-1){
    if(c.at(i)==7){kabu+=ans/a.at(i);ans=ans%a.at(i); }
    if(c.at(i)==8){kabu+=ans/a.at(i+1);ans=ans%a.at(i+1); }
    if(c.at(i)==9){ans+=kabu*a.at(i+1);kabu=0;}

    if(max<ans){max=ans;}
  }}
  cout<<max<<endl;
 
  
  

  
}
