#include <bits/stdc++.h>
using namespace std;
long long int N = 1e9 + 7;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n + 1);
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<vector<long long int> > dp(n + 4, vector<long long int>(64, N));
  dp[0][0] = 0;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 0; j <= 30; j++) {
      dp[i][j + a[i] / 1000] = min(dp[i][j + a[i] / 1000], dp[i - 1][j] + a[i]);
      dp[i][j - min(j, a[i] / 100)] =
          min(dp[i][j - min(j, a[i] / 100)],
              dp[i - 1][j] + a[i] - 100 * min(j, a[i] / 100));
    }
  }
  long long int ans = N;
  for (long long int j = 0; j <= 30; j++) {
    ans = min(ans, dp[n][j]);
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
}
