#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
using namespace std;
constexpr int INF = 1 << 30;
constexpr long long LINF = 1LL << 60;
constexpr long long mod = 1e9 + 7;
constexpr int NIL = -1;
template <class T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int a[100];
int n;
int dfs(int i, int money, int stock) {
  if (i == n - 1) {
    return money + stock * a[i];
  }
  int mx = 0;
  for (int j = 0; j <= money; j += a[i]) {
    for (int k = 0; k <= stock; k++) {
      chmax(mx, dfs(i + 1, money - j + k * a[i], stock + j / a[i] - k));
    }
  }
  return mx;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = (0); i < (n); i++) cin >> a[i];
  cout << dfs(0, 1000, 0) << "\n";
  return 0;
}
