#include <bits/stdc++.h>
using namespace std;
int main() {
  long long LLMAX = 1LL << 60;
  vector<vector<long long> > dp(2005, vector<long long>(2005, LLMAX));
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t, c;
    cin >> t >> c;
    int index;
    for (int j = 0; j <= n; j++) {
      index = min(j + t + 1, n);
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      dp[i + 1][index] = min(dp[i + 1][index], dp[i][j] + c);
    }
    index = min(t + 1, n);
    dp[i + 1][index] = min(dp[i + 1][index], (long long)c);
  }
  cout << dp[n][n] << endl;
}
