#include <bits/stdc++.h>
int a[100], dp[100][1000];
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 1000;
  for (int i = 0; i <= 1000 / a[1]; i++) {
    dp[1][i] = 1000 - a[1] * i;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 1000; j++) {
      if (dp[i][j] >= 0) {
        for (int k = 0; k <= dp[i][j] / a[i + 1]; k++) {
          dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] - k * a[i + 1]);
        }
        for (int k = 1; k <= j; k++) {
          dp[i + 1][j - k] = max(dp[i + 1][j - k], dp[i][j] + k * a[i + 1]);
        }
      }
    }
  }
  printf("%d\n", dp[n][0]);
  return 0;
}
