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