#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<vector<long long>> b(N + 1, vector<long long>(10000));
  vector<vector<bool>> check(N + 1, vector<bool>(10000, false));
  b[0][0] = 1000;
  check[0][0] = true;
  for (int i = 0; i < N; i++) {
    int p = A[i];
    for (int j = 0; j < 10000; j++) {
      if (b[i][j] >= p) {
        int cnt = 1;
        while (b[i][j] >= p * cnt) {
          b[i + 1][j + cnt] = max(b[i + 1][j + cnt], b[i][j] - p * cnt);
          check[i + 1][j + cnt] = true;
          cnt++;
        }
      }
      int cnt = j;
      while (cnt >= 0) {
        if (!check[i][j]) break;
        b[i + 1][j - cnt] = max(b[i + 1][j - cnt], b[i][j] + p * cnt);
        check[i + 1][j - cnt] = true;
        cnt--;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 10000; i++) ans = max(ans, b[N][i]);
  cout << ans << endl;
}
