#include <bits/stdc++.h>
const int MAXN = 2005;
const int MOD = 1e9 + 7;
using namespace std;
int n;
long long int t[MAXN];
long long int c[MAXN];
long long int dp[MAXN][MAXN];
long long int solve(int index, int capacity) {
  if (capacity >= n) {
    return 0;
  }
  if (index > n) {
    return 1e15;
  }
  if (dp[index][capacity] != -1) {
    return dp[index][capacity];
  }
  return dp[index][capacity] =
             min(solve(index + 1, capacity),
                 c[index] + solve(index + 1, capacity + t[index]));
}
int main() {
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      dp[i][j] = 1e15;
    }
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> t[i] >> c[i];
    t[i]++;
  }
  for (int i = n; i >= 0; --i) {
    for (int j = n; j >= 0; --j) {
      if (j + t[i] >= n) {
        dp[i][j] = min(dp[i + 1][j], c[i]);
      } else if (i + 1 > n) {
        dp[i][j] = min(dp[i + 1][j], (long long int)1e15);
      } else {
        dp[i][j] = min(dp[i + 1][j], c[i] + dp[i + 1][j + t[i]]);
      }
    }
  }
  cout << dp[1][0] << endl;
}
