#include <bits/stdc++.h>
using namespace std;
int n;
long long t[2005], c[2005];
long long dp[2005][4005];
long long dfs(long long pos, long long ok) {
  if (ok >= 2000) ok = 2000;
  if (pos == n + 1) {
    if (ok >= 0) return 0;
    return 1e15;
  }
  if (dp[pos][ok + 2000] != -1) return dp[pos][ok + 2000];
  long long ans = 1e15;
  ans = min(ans, dfs(pos + 1, ok + t[pos]) + c[pos]);
  ans = min(ans, dfs(pos + 1, ok - 1));
  return dp[pos][ok + 2000] = ans;
}
int main() {
  cin >> n;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) cin >> t[i] >> c[i];
  cout << dfs(1, 0) << endl;
  return 0;
}
