#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
template <class T>
void pr_vec(vector<T>& v, char ep = ' ') {
  int n = v.size();
  for (int ni = 0; ni < int(n); ++ni) {
    cout << v[ni];
    if (ni != n - 1) cout << ep;
  }
  cout << endl;
};
template <class T>
inline bool chmin(T& a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool chmax(T& a, T b) {
  return a < b ? a = b, true : false;
}
int N;
vector<int> A;
int dfs(int n, int k, int m, int prev) {
  if (n == N) return m;
  if (n == 0)
    return max(
        {dfs(n + 1, k + (m / A[n]), m % (A[n]), A[n]), dfs(n + 1, k, m, prev)});
  else {
    int ret = m;
    if (k > 0 && prev < A[n]) {
      chmax(ret, dfs(n + 1, 0, m + (k * A[n]), 0));
    }
    if (m >= A[n]) {
      chmax(ret, dfs(n + 1, k + (m / A[n]), m % (A[n]), A[n]));
    }
    chmax(ret, dfs(n + 1, k, m, prev));
    return ret;
  }
}
int main(void) {
  cin >> N;
  A.assign(N, 0);
  for (int i = 0; i < int(N); ++i) cin >> A[i];
  pr(dfs(0, 0, 1000, 0));
}
