#include <bits/stdc++.h>
using namespace std;
int n, t[2000], c[2000];
long long dp[2001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i] >> c[i], t[i]++;
  memset(dp, 0x3f, sizeof dp);
  dp[0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = n; j >= 0; j--)
      dp[j] = min(dp[j], (j - t[i] >= 0 ? dp[j - t[i]] : 0) + c[i]);
  cout << dp[n] << "\n";
  return 0;
}
