#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n + 2];
  int t, c;
  for (int i = 1; i < n + 2; ++i) {
    a[i] = 1e18;
  }
  a[0] = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> t >> c;
    t++;
    for (int j = n; j > 0; j--) {
      a[j] = min(a[j], a[max(0, j - t)] + c);
    }
  }
  cout << a[n];
  return 0;
}
