#include <bits/stdc++.h>
using namespace std;
long long n, a, b, dp[2001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  memset(dp, 63, sizeof(dp)), dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    a++;
    for (int j = n; j >= 0; j--) {
      if (j >= a)
        dp[j] = min(dp[j], dp[j - a] + b);
      else
        dp[j] = min(dp[j], b);
      if (i == n) break;
    }
  }
  cout << dp[n];
}
