#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2001;
int n;
int t[Maxn];
long long c[Maxn];
long long dp[Maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) scanf("%d%lld", t + i, c + i);
  long long INF = 1000000000000000LL;
  for (int i = 0; i < (int)(Maxn); ++i) dp[i] = INF;
  dp[0] = 0;
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = n; j >= 0; --j) {
      int tn = min(n, j + t[i] + 1);
      dp[tn] = min(dp[tn], dp[j] + c[i]);
    }
  }
  printf("%I64d\n", dp[n]);
  return 0;
}
