#include <bits/stdc++.h>
using namespace std;
using namespace std;
inline int in() {
  int x = 0, c;
  for (; (unsigned int)((c = getchar()) - '0') >= 10;) {
    if (c == '-') return -in();
    if (!~c) throw ~0;
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while ((unsigned int)((c = getchar()) - '0') < 10);
  return x;
}
inline int gcd(int a, int b) {
  if (a > b) swap(a, b);
  return a == 0 ? b : gcd(b % a, a);
}
inline int lcm(int a, int b) { return a * b / gcd(a, b); }
long long dp[2005];
int N, a, b;
int main() {
  memset(dp, 127, sizeof(dp));
  dp[0] = 0;
  N = in();
  for (int i = 0; i < N; i++) {
    a = in(), b = in();
    for (int j = N; j > 0; j--) dp[j] = min(dp[j], dp[max(0, j - a - 1)] + b);
  }
  printf("%I64d\n", dp[N]);
  return 0;
}
