#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long fact[100001];
long long power(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    y >>= 1;
  }
  return res;
}
long long nCr(long long n, long long r) {
  if (r > n)
    return 0;
  else if (r < 0)
    return 0;
  else if (r == 0 || r == n)
    return 1;
  long long ans = fact[n];
  ans = (ans * power(n - r, mod - 2)) % mod;
  ans = (ans * power(r, mod - 2));
  return ans;
}
int solve(string s) {
  int ans = 0;
  for (int i = 0; i < s.length(); i++) ans = ans | (power(2LL, s[i] - '0'));
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long t[n + 1], c[n + 1];
    for (long long i = 1; i <= n; i++) {
      cin >> t[i] >> c[i];
      t[i]++;
    }
    long long dp[n + 1][n + 1];
    for (long long i = 0; i <= n; i++) {
      for (long long j = 0; j <= n; j++) {
        dp[i][j] = 1e18;
      }
    }
    dp[0][0] = 0;
    long long ans = 1e18;
    for (long long i = 1; i <= n; i++) {
      dp[i][0] = 0;
      for (long long j = 0; j <= n; j++) {
        if (j + t[i] >= n) ans = min(ans, dp[i - 1][j] + c[i]);
        if (j >= t[i])
          dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - t[i]] + c[i]);
        else
          dp[i][j] = dp[i - 1][j];
      }
    }
    cout << ans << endl;
  }
  return 0;
}
