#include <bits/stdc++.h>
using ll = long long;
const ll MOD = 1000000007;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (auto& a : A) cin >> a;
  using T = pair<int, pair<int, int>>;
  T fs{1, {1000, 0}};
  stack<T> q;
  q.push(fs);
  int ans = 1000;
  while (!q.empty()) {
    auto&& x = q.top();
    q.pop();
    auto t = x.first;
    auto s = x.second;
    for (int k = -s.second; k <= s.first / A[t - 1]; k < 0 ? k = 0 : ++k) {
      int m = s.first - k * A[t - 1];
      if (t >= N) {
        ans = max(ans, m);
        break;
      } else {
        q.push(make_pair(t + 1, make_pair(m, s.second + k)));
      }
    }
  }
  cout << ans << endl;
  return 0;
}
