#include <bits/stdc++.h>
using namespace std;
int n, t[2100], c[2100];
long long pd[3000];
bool read() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &t[i], &c[i]);
    t[i]++;
  }
  return true;
}
void process() {
  pd[0] = 0;
  for (int i = 1; i <= n; i++) {
    pd[i] = 0x6363636363636363LL;
  }
  for (int i = 0; i < n; i++) {
    for (int j = n; j >= 0; j--) {
      if (j >= t[i])
        pd[j] = min(pd[j], c[i] + pd[j - t[i]]);
      else
        pd[j] = min(pd[j], (long long)c[i]);
    }
  }
  cout << pd[n] << endl;
}
int main() {
  read();
  process();
  return 0;
}
