#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int INF = 1e9;
const lint LINF = 1e18;
const lint MOD = 1e9 + 7;
const double EPS = 1e-10;
const int M = 100000;
int main() {
  int N;
  cin >> N;
  vector<lint> A(N, 0);
  for (int i = (int)(0); i < (int)(N); i++) cin >> A[i];
  vector<vector<lint>> ma(N + 1, vector<lint>(M, -1));
  ma[0][0] = 1000;
  for (int i = 0; i < N; i++) {
    bool ext = false;
    for (int j = 0; j < M and !ext; j++) {
      if (ma[i][j] == -1) {
        ext = true;
        continue;
      }
      for (int a = 0; a * A[i] <= ma[i][j]; a++) {
        ma[i + 1][j + a] = max(ma[i + 1][j + a], ma[i][j] - a * A[i]);
      }
      for (int b = 0; b <= j; b++) {
        ma[i + 1][j - b] = max(ma[i + 1][j - b], ma[i][j] + b * A[i]);
      }
    }
  }
  cout << ma[N][0] << endl;
  return 0;
}
