#include <bits/stdc++.h>
long long N, dp[4100];
struct item {
  long long t, c;
} items[2100];
using namespace std;
int main() {
  cin >> N;
  long long MV = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> items[i].t >> items[i].c;
    ++items[i].t;
    MV = max(MV, items[i].t);
  }
  MV += N;
  memset(dp, 0x7f, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= N; ++i)
    for (int j = MV; j >= items[i].t; --j)
      dp[j] = min(dp[j], dp[j - items[i].t] + items[i].c);
  long long ans = 1E18 + 7;
  for (int i = N; i <= MV; ++i) ans = min(ans, dp[i]);
  cout << ans << endl;
  return 0;
}
