#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
const long long INF = 1e18 + 5;
pair<long long, long long> arr[MAXN];
long long dp[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  for (int i = 0; i < int(MAXN); i++) dp[i] = INF;
  int n;
  cin >> n;
  for (int i = 0; i < int(n); i++) {
    int t, c;
    cin >> t >> c;
    arr[i] = {t, c};
  }
  dp[0] = 0;
  for (int i = 0; i < int(n); i++)
    for (int j = int(n + 1) - 1; j >= 0; j--)
      if (j - arr[i].first - 1 >= 0)
        dp[j] = min(dp[j], dp[j - arr[i].first - 1] + arr[i].second);
      else
        dp[j] = min(dp[j], arr[i].second);
  cout << dp[n];
  return 0;
}
