#include <bits/stdc++.h>
using namespace std;
inline long long int mul(long long int a, long long int b) {
  return (a * 1ll * b) % 998244353;
}
inline long long int sub(long long int a, long long int b) {
  long long int c = a - b;
  if (c < 0) c += 998244353;
  return c;
}
inline long long int add(long long int a, long long int b) {
  long long int c = a + b;
  if (c >= 998244353) c -= 998244353;
  return c;
}
inline long long int max(long long int a, long long int b) {
  return a > b ? a : b;
}
inline long long int min(long long int a, long long int b) {
  return a < b ? a : b;
}
struct comp {
  template <class T1, class T2, class T3, class T4>
  bool operator()(const pair<T1, T2> &p1, const pair<T3, T4> &p2) {
    return p1.first < p2.first;
  }
};
map<long long int, long long int> dp[81];
long long int rec(vector<long long int> &a, long long int low,
                  long long int high, long long int m, long long int curr) {
  if (low > high)
    return curr;
  else if (dp[m].find(curr) != dp[m].end())
    return dp[m][curr];
  else {
    if (a[low] <= a[m]) m = low;
    long long int ans = 0;
    if (a[low] > a[m])
      ans = max(ans, rec(a, low + 1, high, low + 1,
                         curr + (a[low] - a[m]) * (curr / a[m])));
    ans = max(ans, rec(a, low + 1, high, m, curr));
    return dp[m][curr] = ans;
  }
}
int main() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  cout << rec(a, 0, n - 1, 0, 1000) << "\n";
}
