#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll LLINF{1001002003004005006};
constexpr int INTINF{1000000000};
template <typename T>
void maxs(T& x, T&& y) {
  x = std::max(x, y);
}
template <typename T>
void maxs(T& x, T& y) {
  x = std::max(x, y);
}
template <typename T>
void mins(T& x, T&& y) {
  x = std::min(x, y);
}
template <typename T>
void mins(T& x, T& y) {
  x = std::min(x, y);
}
using P = std::pair<int, int>;
int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  std::vector<int> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  std::vector<P> now(3);
  now[0].first = 1000;
  now[0].second = 0;
  now[1].first = 1000;
  now[1].second = 0;
  now[2].first = 1000;
  now[2].second = 0;
  for (int i = 0; i < (n); ++i) {
    std::vector<P> next(3);
    {
      next[0].second = 0;
      next[0].first = 0;
      for (int j = 0; j < (3); ++j) {
        maxs(next[0].first, now[j].first + now[j].second * a[i]);
      }
    }
    {
      next[1].first = 0;
      next[1].second = 0;
      for (int j = 0; j < (3); ++j) {
        if (next[1].second < now[j].second + now[j].first / a[i]) {
          next[1].second = now[j].second + now[j].first / a[i];
          next[1].first = now[j].first % a[i];
        } else if (next[1].second == now[j].second + now[j].first / a[i] &&
                   next[1].first < now[j].first % a[i]) {
          next[1].first = now[j].first % a[i];
        }
      }
    }
    {
      next[2].first = now[2].first;
      next[2].second = now[2].second;
    }
    now = next;
  }
  std::cout << now[0].first << '\n';
}
