#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	// ll sum = 1000;
	// REP(i,40) {
	// 	sum *= 2;
	// 	debug(sum);
	// }
	int N; cin >> N;
	vl A(N);
	REP(i,N) cin >> A[i];
	ll sum = 1000;
	using p = pair<int, int>;
	vector<p> ps;
	int cur = -1;
	int cand = -1;
	REP(i,N) {
		if (cur == -1) {
			cur = A[i];
			continue;
		} else if (A[i] >= cur && A[i] >= cand) {
			cand = A[i];
		} else {
			if (cur != -1 && cand != -1) {
				ps.emplace_back(cur, cand);
			}
			cur = -1;
			cand = -1;
		}
	}
	if (cur != -1 && cand != -1) {
		ps.emplace_back(cur, cand);
	}
	int pn = ps.size();
	auto dfs = [&](auto dfs, int v, ll res) -> ll {
		if (v > pn) return res;
		ll max_res = res;
        FOR(i, v, pn) {
			if (i > v) break;
			ll n = res / ps[v].first;
			res -= n * ps[v].first;
			res += n * ps[i].second;
			ll response = dfs(dfs, i + 1, res);
			chmax(max_res, response);
        }
		return max_res;
    };
    ll ans = dfs(dfs, 0, sum);
	cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}
