#include <bits/stdc++.h>
using namespace std;
int t[2010];
long long c[2010];
long long dp[2010][2010];
int main(void) {
  int N, i, j;
  cin >> N;
  for ((i) = 0; (i) < (int)(N); (i)++) {
    cin >> t[i] >> c[i];
    t[i]++;
  }
  for ((i) = 0; (i) < (int)(N + 1); (i)++)
    for ((j) = 0; (j) < (int)(N + 1); (j)++) dp[i][j] = (1ll << 60);
  dp[0][0] = 0;
  for ((i) = 0; (i) < (int)(N); (i)++)
    for ((j) = 0; (j) < (int)(N + 1); (j)++) {
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      int j2 = min(j + t[i], N);
      dp[i + 1][j2] = min(dp[i + 1][j2], dp[i][j] + c[i]);
    }
  cout << dp[N][N] << endl;
}
