#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
#define int unsigned long long
using namespace std;
unordered_map<int, int> dp;
int n, x, curr, cnt, nc, np, p, res;
main() {
    DAU
    cin >> n;
    dp[0] = 1000;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        for (const auto& P : dp) {
            tie(cnt, curr) = P;
            dp[0] = max(dp[0], curr + cnt * x);
            p = curr / x;
            nc = cnt + p;
            dp[nc] = max(dp[nc], curr - p * x);
        }
    }
    for (const auto& P : dp)
        res = max(res, P.second);
    cout << res;
    PLEC
}
