#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000;
const int INF = 1000000000;
const int MAXV = 40;
int n;
int a[MAXN];
int dp[2][MAXV + 1];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i <= MAXV; i++) dp[0][i] = INF;
  dp[0][0] = 0;
  int t = 0;
  for (int i = 0; i < n; i++, t = 1 - t) {
    for (int j = 0; j <= MAXV; j++) dp[1 - t][j] = INF;
    for (int j = 0; j <= MAXV; j++)
      if (dp[t][j] < INF) {
        int nj = min(j + a[i] / 1000, MAXV);
        dp[1 - t][nj] = min(dp[1 - t][nj], dp[t][j] + a[i]);
        int discount = min(a[i], 100 * j);
        nj = j - discount / 100;
        dp[1 - t][nj] = min(dp[1 - t][nj], dp[t][j] + a[i] - discount);
      }
  }
  int res = INF;
  for (int i = 0; i <= MAXV; i++) res = min(res, dp[t][i]);
  printf("%d\n", res);
}
