#include <bits/stdc++.h>
using namespace std;
const int maxn = 2050;
int t[maxn], c[maxn];
long long dp[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &t[i], &c[i]);
    dp[i] = 1e18;
    t[i]++;
  }
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = n; j >= 1; j--) {
      dp[j] = min(dp[max(j - t[i], 0)] + c[i], dp[j]);
    }
  }
  printf("%lld\n", dp[n]);
  return 0;
}
