#include <bits/stdc++.h>
using namespace std;
int n, a[85], memo[85];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    pq;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  memset(memo, -1, sizeof memo);
  pq.push(pair<int, int>(1, -1000));
  while (!pq.empty()) {
    int day, money;
    tie(day, money) = pq.top();
    pq.pop();
    money = -money;
    if (memo[day] != -1) continue;
    memo[day] = money;
    for (int i = day; i <= n; ++i) {
      pq.push(
          pair<int, int>(i + 1, -(money + (money / a[day]) * (a[i] - a[day]))));
    }
  }
  int ans = memo[n + 1];
  printf("%d", ans);
}
