#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1 << 30) - 1;
const ll LINF = (1LL << 62) - 1;
inline int in() {
  int x;
  cin >> x;
  return x;
}
inline ll lin() {
  ll x;
  cin >> x;
  return x;
}
inline char chin() {
  char x;
  cin >> x;
  return x;
}
inline string stin() {
  string x;
  cin >> x;
  return x;
}
inline double din() {
  double x;
  cin >> x;
  return x;
}
template <typename T>
inline ll suma(const vector<T>& a) {
  ll res(0);
  for (auto&& x : a) res += x;
  return res;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
char itoa(int n) { return n + '0'; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const int dy[4] = {0, -1, 0, 1};
const int dx[4] = {1, 0, -1, 0};
int n;
vi a;
int ans = 0;
int memo[85][100005];
void dfs(int i, int j, int tot) {
  if (memo[i][j] == tot) return;
  if (i == n) {
    chmax(ans, tot);
    return;
  }
  dfs(i + 1, j + tot / a[i], tot - (tot / a[i]) * a[i]);
  dfs(i + 1, 0, tot + j * a[i]);
  memo[i][j] = tot;
  return;
}
int main() {
  cin >> n;
  a = vi(n);
  for (int i = (0); i < (n); ++i) cin >> a[i];
  for (int i = (0); i < (85); ++i)
    for (int j = (0); j < (100005); ++j) memo[i][j] = -1;
  dfs(0, 0, 1000);
  cout << ans << endl;
  return 0;
}
