#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl '\n'
#define TIME 1.0*clock()/CLOCKS_PER_SEC
#define pii pair < int , int >
#define Endl '\n'

#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;

template <typename T> using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 gen(chrono::system_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const int FFTM = 998244353;

const int SX[4] = {0 , 1 , -1 , 0};
const int SY[4] = {1 , 0 , 0 , -1};
const int rx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
const int ry[8] = {0, 0, 1, -1, 1, -1, 1, -1};
const int kx[8] = {1, 1, -1, -1, 2, 2, -2, -2};
const int ky[8] = {2, -2, 2, -2, 1, -1, 1, -1};

typedef cc_hash_table< int, int, hash<int>, equal_to<int>, direct_mask_range_hashing<int>, hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

const int N = 8001;

ll dp[90][N];

void clar(){
    for (int i = 0;i <= 89; ++i){
        for (int j = 0;j < N; ++j)dp[i][j] = -1;
    }
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("gotham.in", "r", stdin);
//    freopen("gotham.out", "w", stdout);
#endif
    int n;
    cin >> n;
    vector < ll > a(n + 1);
    for (int i = 1;i <= n; ++i){
        cin >> a[i];
    }
    clar();
    dp[0][0] = 1000;
    for (int i = 0;i <= n - 1; ++i){
        for (int st = 0;st < N; ++st){
            if (dp[i][st] == -1)continue;
            for (int delta = -st;delta < N; ++delta){
                int nst = st + delta;
                ll sum = dp[i][st] - delta * a[i + 1];
                if (nst >= N || sum < 0)break;
                if (sum >= 0)dp[i + 1][nst] = max(dp[i + 1][nst], sum);
            }
        }
    }
    ll ans = 1000;
    for (int i = 0;i < N; ++i)
        if (dp[n][i] != -1)ans = max(ans, dp[n][i] + i * a[n]);
    cout << ans << endl;
    return 0;
}
