#include <bits/stdc++.h>
using namespace std;
const int maxn = 2048;
const long long inf = 1LL << 60;
long long f[2][maxn];
int t[maxn], c[maxn];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d %d", t + i, c + i);
  int z = 0;
  for (int i = 0; i < (n + 1); ++i) f[z][i] = inf;
  f[z][0] = 0;
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (n + 1); ++j) f[z ^ 1][j] = inf;
    for (int j = 0; j < (n + 1); ++j)
      if (f[z][j] != inf) {
        f[z ^ 1][j] = min(f[z ^ 1][j], f[z][j]);
        int k = j + t[i] + 1;
        if (k > n) k = n;
        f[z ^ 1][k] = min(f[z ^ 1][k], f[z][j] + c[i]);
      }
    z ^= 1;
  }
  cout << f[z][n] << endl;
  return 0;
}
