#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long a[200005];
int maxn, n;
void dfs(int sum, int x, int num) {
  if (x == n + 1) {
    maxn = max(maxn, sum);
    return;
  }
  if (num == 0) {
    dfs(sum - sum / a[x] * a[x], x + 1, sum / a[x]);
    dfs(sum, x + 1, num);
  } else {
    dfs(sum, x + 1, num);
    dfs(sum + a[x] * num, x + 1, 0);
  }
}
int main() {
  cin >> n;
  maxn = 0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dfs(1000, 1, 0);
  cout << maxn << endl;
}
