#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double PI = acos(-1);
const long double EPS = 0.0000000001;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> v[i];
  vector<vector<long long>> dp(n + 1, vector<long long>(n + 1, 1000));
  for (long long i = 0; i < (long long)(n); i++) {
    for (long long j = 0; j < (long long)(i + 1); j++) {
      for (long long k = j; k < (long long)(n); k++) {
        for (long long x = k + 1; x < (long long)(n); x++) {
          dp[i + 1][x + 1] = max(dp[i + 1][x + 1], dp[i][j + 1] / v[k] * v[x] +
                                                       dp[i][j + 1] % v[k]);
        }
      }
    }
  }
  cout << dp[n][n] << endl;
}
