#include <bits/stdc++.h>
using namespace std;
const int ZERO = 4005;
int n;
long long d[8100], td[2][8100];
int main() {
  while (scanf("%d", &n) == 1) {
    memset(d, 0x7f, sizeof(d));
    d[ZERO] = 0;
    for (int i = 0; i < n; ++i) {
      int t, c;
      scanf("%d%d", &t, &c);
      for (int j = n; j >= -n; --j) td[0][ZERO + j] = d[ZERO + j - t] + c;
      for (int j = n; j >= -n; --j) td[1][ZERO + j] = d[ZERO + j + 1];
      for (int j = n; j >= -n; --j)
        d[ZERO + j] = min(td[0][ZERO + j], td[1][ZERO + j]);
    }
    long long ans = 0xfffffffffffffffLL;
    for (int i = 0; i <= ZERO; ++i) {
      if (ans > d[ZERO + i]) ans = d[ZERO + i];
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
