#include <bits/stdc++.h>
using namespace std;
long long mem[2005][4005];
int n, t[2005], c[2005];
long long back(int i, int j) {
  if (mem[i][j + 2005] != -1) return mem[i][j + 2005];
  if (i == 0) return mem[i][j + 2005] = j >= 0 ? 0 : (1ll << 50);
  if (j >= i) return 0;
  return mem[i][j + 2005] =
             min(back(i - 1, j - 1), back(i - 1, j + t[i]) + c[i]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", &t[i], &c[i]);
  memset(mem, -1, sizeof mem);
  cout << back(n, 0) << endl;
  return 0;
}
