#include <bits/stdc++.h>
using namespace std;
int dirx[] = {1, -1, 0, 0}, diry[] = {0, 0, 1, -1};
long long bigmod(long long x, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) res = (res * x) % 998244353;
    x = (x * x) % 998244353;
    p >>= 1;
  }
  return res;
}
vector<int> inp(100);
int n;
map<pair<pair<int, int>, int>, int> dp;
int rec(int pos, int stk, int ab) {
  if (pos >= n) return ab;
  if (dp[{{pos, stk}, ab}] != 0) return dp[{{pos, stk}, ab}];
  int a = 0, b = 0;
  if (stk) a = rec(pos + 1, 0, ab + stk * inp[pos]);
  if (ab) b = rec(pos + 1, stk + ab / inp[pos], ab % inp[pos]);
  return dp[{{pos, stk}, ab}] = max(a, b);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> inp[i];
  cout << rec(0, 0, 1000);
  return 0;
}
