#include <bits/stdc++.h>
using namespace std;
const long long OO = (long long)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy";
template <typename X, typename Y>
bool ckmin(X& a, Y b) {
  return a > b ? a = b, true : false;
}
template <typename X, typename Y>
bool ckmax(X& a, Y b) {
  return a < b ? a = b, true : false;
}
bool cklex(string& a, string b) {
  if (b == "") return false;
  if (a == "") return a = b, true;
  if ((int)a.size() < (int)b.size()) return false;
  if ((int)b.size() < (int)a.size()) return a = b, true;
  if (a < b) return false;
  return a = b, true;
}
int dcmp(long double d1, long double d2) {
  return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1;
}
long long gcd(long long x, long long y) { return !y ? x : gcd(y, x % y); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol * r) + c + 1; }
pair<int, int> conv_1_2(int n, int nCol) { return {n / nCol, n % nCol}; }
template <typename T>
void inter(T X) {
  cout << X << endl;
  fflush(stdout);
}
int dp[85][175][17100];
int n;
int a[90];
int solve(int idx, int have, int money) {
  if (idx >= n) return money;
  int& ret = dp[idx][have][money];
  if (~ret) return ret;
  return ret = max({solve(idx + 1, have + money / a[idx], money % a[idx]),
                    solve(idx + 1, 0, money + have * a[idx]),
                    solve(idx + 1, have, money)});
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    cin >> n;
    memset(dp, -1, sizeof dp);
    for (int i = 0; i < n; i++) cin >> a[i];
    cout << solve(0, 0, 1000) << endl;
  }
  return 0;
}
