#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long c[n], t[n];
  for (long long i = 0; i < n; i++) cin >> t[i] >> c[i];
  for (long long i = 0; i < n; i++) t[i]++;
  long long d[n + 1][n + 1];
  for (long long i = 0; i <= n; i++)
    for (long long j = 0; j <= n; j++) d[i][j] = 1e18;
  d[0][0] = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= n; j++) {
      long long prv = max(0LL, j - t[i - 1]);
      d[i][j] = min(d[i - 1][j], c[i - 1] + d[i - 1][prv]);
    }
  }
  long long ans = d[n][n];
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  while (T--) solve();
  return 0;
}
