#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

const int MAX_N=80;
const int MAX_C=150000000;

int N;
int A[MAX_N+1];
int dp[2][MAX_C+5];
int ans;



void init(){
    for(int i=0;i<2;++i)for(int j=0;j<MAX_C+5;++j)dp[i][j]=-1;
}

signed main(){
    init();
    cin>>N;
    for(int i=0;i<N;++i)cin>>A[i];
    dp[0][0]=1000;
    for(int i=0;i<N;++i){
        for(int j=0;j<=MAX_C;++j){
            if(dp[i%2][j]==-1)continue;
            chmax(dp[(i+1)%2][j],dp[i%2][j]);
            chmax(dp[(i+1)%2][0],dp[i%2][j]+A[i]*j);
            int k=dp[i%2][j]/A[i];
            chmax(dp[(i+1)%2][j+k],dp[i%2][j]-A[i]*k);
            chmax(ans,dp[(i+1)%2][j]);
            chmax(ans,dp[(i+1)%2][0]);
            chmax(ans,dp[(i+1)%2][j+k]);
        }
    }
    cout<<ans<<endl;
}