#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) { return (a < b) ? a : b; }
long long int dp[2001][2001];
int main() {
  int input[2000][2], n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> input[i][0] >> input[i][1];
    input[i][0]++;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (j <= input[i - 1][0]) {
        if (dp[i - 1][j] == 0)
          dp[i][j] = input[i - 1][1];
        else
          dp[i][j] = min(dp[i - 1][j], input[i - 1][1]);
      } else {
        if (dp[i - 1][j - input[i - 1][0]] == 0)
          break;
        else if (dp[i - 1][j] == 0) {
          dp[i][j] = dp[i - 1][j - input[i - 1][0]] + input[i - 1][1];
        } else {
          dp[i][j] = min(dp[i - 1][j - input[i - 1][0]] + input[i - 1][1],
                         dp[i - 1][j]);
        }
      }
    }
  }
  cout << dp[n][n] << endl;
  return 0;
}
