#include <bits/stdc++.h>
long long chk[2001];
int n;
int main() {
  int c, t;
  scanf("%d", &n);
  for (int i = 0; i <= 2000; i++) chk[i] = -1;
  chk[0] = 0;
  for (int i = 1; i <= n; i++) {
    int tmp;
    scanf("%d%d", &t, &c);
    for (int j = n - 1; j >= 0; j--) {
      tmp = j + t + 1;
      if (tmp > n) tmp = n;
      if ((chk[tmp] == -1 && chk[j] != -1) ||
          (chk[j] + (long long)c < chk[tmp] && chk[j] != -1))
        chk[tmp] = chk[j] + (long long)c;
    }
  }
  printf("%lld", chk[n]);
}
