#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 998244353;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 998244353;
    }
    a = (a * a) % 998244353;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 998244353 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
const long long dx[] = {-1, 0, 1, 0, -1, 1, 1, -1};
const long long dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
long long n;
long long a[81];
long long dp[81][80001];
long long foo(long long i, long long cost) {
  if (i == n) return cost;
  long long &ans = dp[i][cost];
  if (ans != -1LL) return ans;
  long long nos = cost / a[i];
  ans = cost;
  long long residue = cost - (nos * a[i]);
  for (long long j = i + 1; j < n; j++) {
    long long ans1 = (a[j] * nos) + residue;
    ans1 = foo(j + 1, ans1);
    ans = max(ans, ans1);
  }
  return ans;
}
void solve() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    memset(dp, -1LL, sizeof(dp));
    long long ans1 = foo(i, 1000LL);
    ans = max(ans1, ans);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
