#include <bits/stdc++.h>
using namespace std;
const int N = 2003;
const long long M = 1e9 + 7;
const long long inf = 1e18 + 5;
long long t[N], c[N];
long long dp[N][N];
int n;
long long rec(int pos, int tme) {
  if (tme >= n) return 0;
  if (pos == n) return inf;
  long long &res = dp[pos][tme];
  if (res != -1) return res;
  res = inf;
  res = min(rec(pos + 1, tme), c[pos] + rec(pos + 1, tme + t[pos] + 1));
  return res;
}
int main() {
  scanf("%d", &n);
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) {
    scanf("%lld", &t[i]);
    scanf("%lld", &c[i]);
  }
  long long ans = rec(0, 0);
  printf("%lld\n", ans);
  ;
}
