v#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f
#define pi 3.1415926535898
using namespace std;
ll a[2000];
ll d[2000];
ll c[2000];
int main()
{
    memset(c,inf,sizeof(c));
    int n;
    cin>>n;

    int  sum=1000;
    int  k=0;
    int x=0,y=0;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    a[0]=-inf;
    a[n+1]=-inf;
    for(int i=1; i<=n; i++)
    {
        if(a[i]>=a[i+1]&&a[i]>a[i-1])
        {
            d[x++]=i;
        }
    }
    a[0]=inf;
    a[n+1]=inf;
    for(int i=1; i<=n; i++)
    {
        if(a[i]<=a[i+1]&&a[i]<a[i-1])
        {
            c[y++]=i;
        }
    }
    int t=1;
    for(int i=0,j=0; j<x&&y>0;)
    {
        if(t%2==1)
        {
            if(c[i]<d[j])
            {
                k=k+sum/a[c[i]];
                sum=sum%a[c[i]];
                i++;
            }
            t=t+1;
        }
        else if(t%2==0)
        {
            if(c[i]>d[j]&&k>0)
            {
                sum=sum+a[d[j]]*k;
                k=0;
                j++;
            }
            else
            {
                j++;
            }
            t++;
        }

    }
    cout<<sum<<endl;
    return 0;
}
