#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    vector<int> age[n];
    vector<int> sage[n];
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(a[i]>a[j])sage[i].push_back(j);
            else if(a[i]<a[j])age[i].push_back(j);
        }
    }
    int ans=0;
    int kane=1000;
    int kabu=0;
    int day=0;
    int MAX;
    while(1){
        if(kabu==0 && age[day].size()>0){
            kabu=kane/a[day];
            kane-=kabu*a[day];
            if(sage[age[day].at(0)].size()>0){
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u] && u < sage[age[day].at(0)].at(0))MAX=u;
                kane+=kabu*a[u];
                kabu=0;
                day=sage[age[day].at(0)].at(0);
            }
            else{
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u])MAX=u;
                kane+=kabu*a[MAX];
                kabu=0;
                break;
            }
        }
        else if(kabu==0 && age[day].size()==0)break;
    }
    ans=max(kane,ans);
    if(sage[0].size()>0){
    for(auto u:sage[0]){
        kane=1000;
        kabu=0;
        day=u;
    while(1){
        if(kabu==0 && age[day].size()>0){
            kabu=kane/a[day];
            kane-=kabu*a[day];
            if(sage[age[day].at(0)].size()>0){
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u] && u < sage[age[day].at(0)].at(0))MAX=u;
                kane+=kabu*a[u];
                kabu=0;
                day=sage[age[day].at(0)].at(0);
            }
            else{
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u])MAX=u;
                kane+=kabu*a[MAX];
                kabu=0;
                break;
            }
        }
        else if(kabu==0 && age[day].size()==0)break;
    }
        ans=max(kane,ans);
        }
    }
    cout << ans;
}