#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],b[n]={0},i,rs=1000,l=5000,p=0,q=0,stock=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    b[n-1]=a[n-1];
    for(i=n-2;i>=0;i--)
    {
        b[i]=max(b[i+1],a[i]);
    }
    for(i=0;i<n;i++)
    {
        if(a[i]<=b[i])
        {
            //cout<<stock<<" "<<rs<<endl;
            if(a[i]>l){
            rs+=(stock*a[i]);
            stock=0;
            }
            if(i==0 || a[i]<a[i-1])
            {
                p=(rs/a[i]);
                stock+=p;
                rs-=p*a[i];
                l=a[i];
            }
        }
        else
            break;
    }
    cout<<max(1000,rs);
    return 0;
}
