#include <bits/stdc++.h>
using namespace std;
long long dp[2002], n, t[2002], c[2002];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 0; i < 2002; ++i) dp[i] = 1e18;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> t[i] >> c[i];
    t[i]++;
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = n; j >= 0; --j) {
      if (j <= t[i])
        dp[j] = min(dp[j], c[i]);
      else
        dp[j] = min(dp[j], dp[j - t[i]] + c[i]);
    }
  }
  cout << dp[n];
  return 0;
}
