#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
const int B = 50;
const int oo = 1e9;
int dp[N][B];
int n, a[N];
int f(int i, int j) {
  if (i == n) return 0;
  if (j >= B) return oo;
  int &ans = dp[i][j];
  if (~ans) return ans;
  ans = f(i + 1, j + a[i]) + a[i] * 10;
  int nj = j - a[i] * 10;
  int add = 0;
  if (nj < 0) {
    add += abs(nj);
    nj = 0;
  }
  ans = min(ans, f(i + 1, nj) + add);
  return ans;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i), a[i] /= 1000;
  printf("%d\n", f(0, 0) * 100);
}
