#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
int n, t[maxn];
long long p[maxn];
long long dp[maxn << 1];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%I64d", &t[i], &p[i]);
    t[i]++;
  }
  memset(dp, 0x3f, sizeof dp);
  dp[0] = 0;
  long long ans = inf;
  for (int i = 1; i <= n; i++) {
    for (int j = 4000; j >= t[i]; j--) {
      dp[j] = min(dp[j], dp[j - t[i]] + p[i]);
    }
  }
  for (int i = n; i <= 4000; i++) {
    ans = min(ans, dp[i]);
  }
  printf("%I64d\n", ans);
  return 0;
}
