#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const long double eps = 1.0e-12;
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
unsigned GetDigit(unsigned num) { return std::to_string(num).length(); }
int tow(int n) {
  if (n == 0) return 1;
  int x = tow(n / 2);
  x *= x;
  if (n % 2 == 1) x *= 2;
  return x;
}
int keta(int n) {
  int sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
long double mysqrtl(long double x) {
  long double a = sqrtl((double)x);
  do {
    a = (a + x / a) / 2.0L;
  } while (fabsl(x - a * a) > eps);
  return a;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a / g * b;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long int ans = 0, n = 0, count = 0, sum = 0, near = 1000, old = 0;
  long long int a, b, k, mon = 1000, nmon = 0, j = 0, lust = 0;
  int value_to_remove = 0;
  bool check = false, checkb = false;
  string ss, sss;
  vector<long long int> array, buy;
  vector<bool> bo(100001, 0);
  vector<char> kabu;
  char c, before = 'a';
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    array.push_back(a);
    c = 'n';
    kabu.push_back(c);
    if (i == 0) {
      continue;
    }
    if (a == array.at(i - 1)) {
      continue;
    }
    if (before == 'a') {
      if (a < array.at(i - 1)) {
        before = 'h';
        kabu.at(i - 1) = 'h';
      } else {
        before = 'l';
        kabu.at(i - 1) = 'l';
        buy.push_back(i - 1);
        count++;
        if (i == n - 1) kabu.at(i) = 'h';
      }
    } else if (before == 'h') {
      if (a <= array.at(i - 1)) {
        c = 'n';
      } else {
        before = 'l';
        kabu.at(i - 1) = 'l';
        buy.push_back(i - 1);
        count++;
        if (i == n - 1) kabu.at(i) = 'h';
      }
    } else if (before == 'l') {
      if (a >= array.at(i - 1)) {
        c = 'n';
      } else {
        kabu.at(i - 1) = 'h';
        before = 'h';
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (kabu.at(i) == 'l') {
      check = true;
      nmon = mon / array.at(buy.at(j));
      mon = mon % array.at(buy.at(j));
      j++;
      lust = i;
    } else if (kabu.at(i) == 'h') {
      if (check == false) continue;
      mon += nmon * array.at(i);
      nmon = 0;
      checkb = true;
    }
  }
  if (checkb = false) mon += nmon * array.at(n - 1);
  if (nmon != 0) mon += nmon * array.at(buy.at(j));
  cout << mon << endl;
  return 0;
}
