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