#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
const long long int N = 2e3 + 3;
long long int maxi = 1e18;
long long int n;
long long int dp[N][N];
long long int t[N], c[N];
long long int solve(long long int i, long long int val) {
  if (val >= n) return 0;
  if (i == n) return maxi;
  if (dp[i][val] != -1) return dp[i][val];
  long long int ans = maxi;
  ans = min(c[i] + solve(i + 1, val + t[i]), solve(i + 1, val));
  return dp[i][val] = ans;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    t[i] = x + 1;
    c[i] = y;
  }
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j <= n; j++) dp[i][j] = -1;
  cout << solve(0, 0);
}
