#include <bits/stdc++.h>
using namespace std;
const long mod = 1e9 + 7;
const int siz = 2e5;
const long inf = 1e9;
int main() {
  int N;
  cin >> N;
  int dp[N + 1][200];
  for (int i = 0; i < N + 1; i++)
    for (int j = 0; j < 200; j++) dp[i][j] = -1;
  dp[0][0] = 1000;
  int a;
  for (int i = 1; i < N + 1; i++) {
    cin >> a;
    for (int j = 0; j < 200; j++) {
      for (int k = 0; k < j + 1; k++) {
        if (dp[i - 1][j] == -1) break;
        dp[i][j - k] = max(dp[i][j - k], dp[i - 1][j] + a * k);
      }
      for (int k = 0; k < dp[i - 1][j] / a + 1; k++) {
        dp[i][j + k] = max(dp[i][j + k], dp[i - 1][j] - a * k);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 200; i++) ans = max(ans, dp[N][i]);
  cout << ans << endl;
}
