#include <bits/stdc++.h>
using namespace std;
const long long dx[4] = {-1, 1, 0, 0};
const long long dy[4] = {0, 0, -1, 1};
long long a[81];
long long n;
long long solve(long long k, long long s1, long long g1, long long in) {
  long long ans = g1;
  for (long long i = k; i < n; i++) {
    if (s1)
      if (a[i] >= a[in])
        ans = max(ans, solve(i + 1, 0, g1 + s1 * a[i], i));
      else
        ans = max(ans, solve(i + 1, g1 / a[k], g1 % a[k], i));
  }
  return ans;
}
signed main() {
  long long ans = 1000;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    ans = max(ans, solve(i + 1, 1000 / a[i], 1000 % a[i], i));
  }
  cout << ans;
  return 0;
}
