#include <bits/stdc++.h>
using namespace std;
const long long inf = 12345678987654321ll;
long long dp[3000];
int n;
int main() {
  cin >> n;
  int t, c;
  for (int i = 1; i <= n; i++) dp[i] = inf;
  for (int i = 1; i <= n; i++) {
    cin >> t >> c;
    ++t;
    for (int i = n + t; i > n; i--) {
      dp[n] = min(dp[n], dp[i - t] + c);
    }
    for (int i = n; i - t >= 0; i--) {
      dp[i] = min(dp[i], dp[i - t] + c);
    }
  }
  cout << dp[n] << endl;
  return 0;
}
