#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int Days[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int read() {
  int ans = 0;
  bool f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) ans = ((ans << 2) + ans << 1) + (ch ^ 48), ch = getchar();
  return f ? ans : -ans;
}
long long n;
long long dp[2010];
long long INF = 10000000000000000ll;
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) dp[i] = INF;
  for (long long i = 1; i <= n; i++) {
    long long t, c;
    cin >> t >> c;
    for (long long j = n; j >= 1; j--)
      dp[j] = min(dp[j], dp[max(j - t - 1, 0ll)] + c);
  }
  cout << dp[n];
  return 0;
}
