#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
const long long INF = 1LL << 60;
int c[MAXN], t[MAXN];
long long dp[MAXN][2 * MAXN];
int n;
int index(int t) {
  int new_t = t + n;
  new_t = min(2 * n, new_t);
  return new_t;
}
int main() {
  ;
  while (cin >> n) {
    for (int i = 1; i <= n; ++i) cin >> t[i] >> c[i];
    for (int i = 0; i <= n; ++i) dp[i][index(-n)] = INF;
    for (int j = -n; j <= 0; ++j) dp[0][index(j)] = INF;
    for (int j = 0; j <= n; ++j) dp[0][index(j)] = 0LL;
    for (int i = 1; i <= n; ++i) {
      for (int j = -n + 1; j <= n; ++j) {
        long long buy = dp[i - 1][index(j + t[i])] + c[i];
        long long steal = dp[i - 1][index(j - 1)];
        dp[i][index(j)] = min(buy, steal);
      }
    }
    long long best = INF;
    for (int j = -n + 1; j <= 0; ++j) {
      best = min(best, dp[n][index(j)]);
    }
    cout << best << endl;
  }
  return 0;
}
