#include <bits/stdc++.h>
using namespace std;
const int N = 4444;
long long dp[N];
int main() {
  memset(dp, 127, sizeof(dp));
  *dp = 0;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int t, c;
    scanf("%d%d", &t, &c);
    for (int j = n; j >= 0; --j) {
      dp[j + t + 1] = min(dp[j + t + 1], dp[j] + c);
    }
  }
  cout << *min_element(dp + n, dp + n + 2222);
  return 0;
}
