#include <bits/stdc++.h>
using namespace std;
const int N = 4e3 + 3;
int t[N], c[N], n;
long long dp[N / 2][N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i] >> c[i];
  for (int i = 0; i < 2000; i++) dp[n][i] = 1e18;
  for (int i = n - 1; i > -1; i--)
    for (int total = 1; total <= 4000; ++total)
      dp[i][total] =
          min(dp[i + 1][total - 1], dp[i + 1][min(4000, total + t[i])] + c[i]);
  cout << dp[0][2000];
}
