#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  ll ans = 1000;
  int k = 0;
  int kugiri = 0;
  vector<int> ku;
  for (int i = 0; i < n; ++i) {
    if (k == 0) {
      if (a[i] < a[i + 1]) {
        k = 1;
        kugiri++;
        ku.push_back(i);
      }
    } else {
      if (a[i] > a[i + 1]) {
        k = 0;
        kugiri++;
        ku.push_back(i);
      }
    }
  }
  int cnt = 0;
  int j = 0;
  int ma, mi;
  ma = 90;
  mi = 201;
  ku.push_back(n);
  vector<int> kouho;
  for (int i = 0; i < n; ++i) {
    if (i < ku[j]) {
      if (cnt % 2 == 0) {
        mi = min(mi, a[i]);
      } else {
        ma = max(ma, a[i]);
      }
    } else if (i == ku[j]) {
      if (cnt % 2 == 0) {
        mi = min(mi, a[i]);
        j++;
        cnt++;
        kouho.push_back(mi);
        mi = 201;
      } else {
        ma = max(ma, a[i]);
        j++;
        cnt++;
        kouho.push_back(ma);
        ma = 90;
      }
    }
  }
  int si = kouho.size();
  int num;
  for (int i = 0; i < si; ++i) {
    if (i % 2 == 0) {
      num = ans / kouho[i];
      ans = ans - (num * kouho[i]);
    } else {
      ans = ans + (num * kouho[i]);
      num = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
