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