#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
int n;
pair<long long, long long> a[maxn];
long long f[maxn][2 * maxn];
bool cmp(pair<long long, long long> x, pair<long long, long long> y) {
  if (x.first != y.first) return x.first < y.first;
  return x.second > y.second;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].second >> a[i].first;
    a[i].second++;
  }
  for (int i = 1; i < 2 * maxn; i++) {
    f[0][i] = 1000000009;
    f[0][i] *= f[0][i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= n; j++) {
      if (j >= a[i].second)
        f[i][j] = min(f[i - 1][j - a[i].second] + a[i].first, f[i - 1][j]);
      else
        f[i][j] = min(f[i - 1][j], a[i].first);
    }
  cout << f[n][n] << endl;
  return 0;
}
