#include <bits/stdc++.h>
using namespace std;
const int mxn = 2005;
const long long inf = 100000000ll * 100000000ll;
int n, m, k;
int c[mxn], t[mxn];
long long memo[mxn][mxn];
long long get(int ci, int items) {
  if (items >= n) return 0;
  if (ci == n) return inf;
  long long &r = memo[ci][items];
  if (r != -1) return r;
  return r = min(get(ci + 1, items), c[ci] + get(ci + 1, items + 1 + t[ci]));
}
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &t[i]);
    scanf("%d", &c[i]);
  }
  memset(memo, -1, sizeof(memo));
  cout << get(0, 0) << endl;
  return 0;
}
