#include <bits/stdc++.h>
using namespace std;
struct FastIO {
  FastIO() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_io_;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
template <class T>
using upq = priority_queue<T, v<T>, greater<T>>;
template <class T>
using dpq = priority_queue<T, v<T>, less<T>>;
using ll = long long;
using vi = v<int>;
using ld = long double;
using vl = v<ll>;
using unit = unsigned;
using vvi = v<vi>;
using ull = unsigned long long;
using vvl = v<vl>;
using pii = pair<int, int>;
using vpii = v<pii>;
using pil = pair<int, ll>;
using vpil = v<pil>;
using pli = pair<ll, int>;
using vpli = v<pli>;
using pll = pair<ll, ll>;
using vpll = v<pll>;
template <class T>
ostream& operator<<(ostream& o, const v<T>& v);
template <class T, size_t N>
ostream& operator<<(ostream& o, const array<T, N>& v);
template <class T>
ostream& operator<<(ostream& o, const deque<T>& v);
template <class T>
ostream& operator<<(ostream& o, const queue<T>& v);
template <class T>
ostream& operator<<(ostream& o, const set<T>& v);
template <class T>
ostream& operator<<(ostream& o, const unordered_set<T>& v);
template <class T>
ostream& operator<<(ostream& o, const multiset<T>& v);
template <class T>
ostream& operator<<(ostream& o, const unordered_multiset<T>& v);
template <class T, class U>
ostream& operator<<(ostream& o, const pair<T, U>& v);
template <class T, class U>
ostream& operator<<(ostream& o, const map<T, U>& v);
template <class T, class U>
ostream& operator<<(ostream& o, const unordered_map<T, U>& v);
template <class T>
ostream& out_with_iter(ostream& o, const T& v) {
  o << "{";
  for (auto x = (v).begin(); x != (v).end(); ++x)
    o << *x << (next(x) == v.end() ? "" : ",");
  return o << "}";
}
template <class T>
istream& operator>>(istream& i, v<T>& v) {
  for (auto& x : v) i >> x;
  return i;
}
template <class T>
ostream& operator<<(ostream& o, const v<T>& v) {
  return out_with_iter(o, v);
}
template <class T, size_t N>
ostream& operator<<(ostream& o, const array<T, N>& v) {
  return out_with_iter(o, v);
}
template <class T>
ostream& operator<<(ostream& o, const deque<T>& v) {
  return out_with_iter(o, v);
}
template <class T>
ostream& operator<<(ostream& o, const queue<T>& v) {
  queue<T> q(v);
  o << "{";
  while (((long long)(q).size())) {
    o << q.front() << (((long long)(q).size()) == 1 ? "" : ",");
    q.pop();
  }
  return o << "}";
}
template <class T>
ostream& operator<<(ostream& o, const set<T>& v) {
  return out_with_iter(o, v);
}
template <class T>
ostream& operator<<(ostream& o, const unordered_set<T>& v) {
  return o << set<T>((v).begin(), (v).end());
}
template <class T>
ostream& operator<<(ostream& o, const multiset<T>& v) {
  return out_with_iter(o, v);
}
template <class T>
ostream& operator<<(ostream& o, const unordered_multiset<T>& v) {
  return o << multiset<T>((v).begin(), (v).end());
}
template <class T, class U>
ostream& operator<<(ostream& o, const pair<T, U>& v) {
  return o << "(" << v.first << "," << v.second << ")";
}
template <class T, class U>
ostream& operator<<(ostream& o, const map<T, U>& v) {
  o << "{";
  for (auto x = (v).begin(); x != (v).end(); ++x)
    o << x->first << "=>" << x->second << (next(x) == v.end() ? "" : ",");
  return o << "}";
}
template <class T, class U>
ostream& operator<<(ostream& o, const unordered_map<T, U>& v) {
  return o << map<T, U>((v).begin(), (v).end());
}
template <class T>
string join(const T& v, char c = ' ') {
  stringstream s;
  for (auto x = (v).begin(); x != (v).end(); ++x) s << c << *x;
  return ((long long)(s.str()).size()) ? s.str().substr(1) : "";
}
template <class T>
void YES(T c) {
  if (c)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
template <class T>
void Yes(T c) {
  if (c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
template <class T>
void POSS(T c) {
  if (c)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
template <class T>
void Poss(T c) {
  if (c)
    cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
}
template <class T>
bool chmax(T& a, const T& b) {
  return a < b ? (a = b, true) : false;
}
template <class T>
bool chmin(T& a, const T& b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
constexpr ll TEN(int n) { return n == 0 ? 1 : 10 * TEN(n - 1); }
constexpr ld EPS = 1e-10;
const ld PI = acos(-1.0);
constexpr int INF = 1001002003;
constexpr ll LINF = 1001002003004005006LL;
constexpr int DX[] = {-1, 0, 1, 0, -1, -1, 1, 1};
constexpr int DY[] = {0, 1, 0, -1, -1, 1, -1, 1};
int n;
vi a;
ll ans = 0;
void dfs(int i, ll m, ll s) {
  if (i == n) {
    chmax(ans, m);
    return;
  }
  ll buy_cnt = m / a[i];
  dfs(i + 1, m - a[i] * (buy_cnt), s + buy_cnt);
  dfs(i + 1, m + s * a[i], 0);
  dfs(i + 1, m, s);
}
int main() {
  cin >> n;
  a.resize(n);
  cin >> a;
  dfs(0, 1000, 0);
  cout << ans << endl;
}
