#include <bits/stdc++.h>
using namespace std;
long long dp[3000];
int max(int a, int b) {
  if (a > b) return a;
  return b;
}
int min(int a, int b) {
  if (a > b) return b;
  return a;
}
int main() {
  int n;
  scanf("%d", &n);
  memset(dp, 0x6f, sizeof(dp));
  dp[n] = 0;
  for (int i = 0; i < n; i++) {
    int t, c;
    scanf("%d%d", &t, &c);
    for (int j = 1; j <= n; j++) {
      int k = max(0, j - t - 1);
      dp[k] = min(dp[k], dp[j] + c);
    }
  }
  cout << dp[0] << endl;
}
