#include <bits/stdc++.h>
const int LMT = 2002;
using namespace std;
long long dp[LMT][LMT], c[LMT];
int t[LMT];
int main() {
  int x, n;
  long long ans = 1e18;
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 0; i <= n; i++) dp[i][0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%I64d", &t[i], &c[i]);
    if (t[i] > n) t[i] = n;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= n; j++) dp[i][j] = dp[i - 1][j];
    for (int j = n; j >= 0; j--)
      if (dp[i - 1][j] != -1) {
        x = j + 1 + t[i];
        if (x > n) x = n;
        if (dp[i - 1][j] != -1) {
          if (dp[i][x] == -1 || dp[i][x] > dp[i - 1][j] + c[i])
            dp[i][x] = dp[i - 1][j] + c[i];
        }
      }
  }
  for (int i = 0; i <= n; i++)
    if (dp[i][n] != -1) ans = min(ans, dp[i][n]);
  cout << ans << endl;
  return 0;
}
