#include <bits/stdc++.h>
int dp[100][10100];
int min(int x, int y) { return x > y ? y : x; }
int max(int x, int y) { return x < y ? y : x; }
int main() {
  int n, a[80];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < 80; i++) {
    for (int j = 0; j < 10000; j++) {
      dp[i][j] = -1;
    }
  }
  dp[0][0] = 1000;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 10000; j++) {
      if (dp[i][j] == -1) {
        continue;
      }
      int nowMoney = dp[i][j];
      for (int k = 0; a[i] * k <= nowMoney; k++) {
        dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] - a[i] * k);
      }
      for (int k = 0; k <= j; k++) {
        dp[i + 1][j - k] = max(dp[i + 1][j - k], dp[i][j] + a[i] * k);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 10000; i++) {
    ans = max(ans, dp[n][i]);
  }
  printf("%d\n", ans);
  return 0;
}
