#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long t[n + 1], c[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> t[i] >> c[i];
    t[i]++;
    if (t[i] > n) {
      t[i] = n;
    }
  }
  long long dp[n + 1][n + 1];
  for (int i = 1; i < n + 1; i++) {
    dp[0][i] = 100000000000000;
  }
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = n; j >= 0; --j) {
      dp[i][j] = dp[i - 1][j];
      if (j >= t[i]) {
        dp[i][j] = min(dp[i][j], dp[i - 1][j - t[i]] + c[i]);
      }
      if (j != n) {
        dp[i][j] = min(dp[i][j], dp[i][j + 1]);
      }
    }
  }
  cout << dp[n][n];
}
