#include <bits/stdc++.h>
using namespace std;
long long const maxx = 1e15;
int main() {
  long long dp[4020], time[2010], va[2010], ans;
  int x, y;
  int i, j;
  int n;
  while (scanf("%d", &n) == 1) {
    for (i = 0; i < n + n; i++) dp[i] = maxx;
    dp[0] = 0;
    for (i = 0; i < n; i++) {
      scanf("%d%d", &x, &y);
      x++;
      time[i] = x;
      va[i] = y;
    }
    for (i = 0; i < n; i++) {
      for (j = n; j >= 0; j--) {
        if (j >= time[i])
          dp[j] = min(dp[j], dp[j - time[i]] + va[i]);
        else
          dp[j] = min(dp[j], va[i]);
      }
    }
    printf("%I64d\n", dp[n]);
  }
  return 0;
}
