#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
int n;
int t[maxn], c[maxn];
long long d[maxn][maxn];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i] >> c[i];
  for (int i = 0; i < n + 1; i++) d[0][i] = 1ll << 62;
  d[0][0] = 0;
  for (int i = 1; i < n + 1; i++) {
    d[i][0] = 0;
    for (int j = 1; j < n + 1; j++) {
      d[i][j] = d[i - 1][j];
      int tmp = max(0, j - t[i - 1] - 1);
      if (d[i - 1][tmp] + c[i - 1] < d[i][j])
        d[i][j] = d[i - 1][tmp] + c[i - 1];
    }
  }
  cout << d[n][n] << endl;
  return 0;
}
