#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INF64 = 1e18;
const long long MOD = 1e9 + 7;
const long double EPS = 1e-9;
const long double Pi = 3.1415926535897932384626433832795;
const int N = 3e5 + 17;
const int M = 32;
int dp[N][M];
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < int(n); i++) scanf("%d", &a[i]);
  for (int i = 0; i < int(N); i++)
    for (int j = 0; j < int(M); j++) dp[i][j] = INF;
  dp[0][0] = 0;
  for (int i = 0; i < int(n); i++) {
    for (int j = 0; j < int(M); j++) {
      if (j + a[i] / 1000 < M)
        dp[i + 1][j + a[i] / 1000] =
            min(dp[i + 1][j + a[i] / 1000], dp[i][j] + a[i]);
      dp[i + 1][j - min(j, a[i] / 100)] =
          min(dp[i + 1][j - min(j, a[i] / 100)],
              dp[i][j] + a[i] - 100 * min(j, a[i] / 100));
    }
  }
  int ans = INF;
  for (int i = 0; i < int(M); i++) ans = min(ans, dp[n][i]);
  cout << ans << endl;
}
