#include <bits/stdc++.h>
using namespace std;
long long dp[4000100];
long long n;
signed main() {
  cin >> n;
  for (long long i = (1); i < (n + 10); i++) dp[i] = 1000000000000000000;
  for (long long i = (0); i < (n); i++) {
    long long t1, t2;
    cin >> t1 >> t2;
    t1++;
    for (long long i = n - 1; i >= 0; i--)
      if (dp[i] < 100000000000000000) {
        dp[min(i + t1, n)] = min(dp[min(i + t1, n)], dp[i] + t2);
      }
  }
  cout << dp[n];
  return 0;
}
