#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long t[n], c[n];
  for (long long i = 0; i < n; i++) cin >> t[i] >> c[i], t[i]++;
  vector<long long> dp(2050, 1e18);
  dp[0] = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 2040; j >= t[i]; j--)
      dp[j] = min(dp[j], dp[j - t[i]] + c[i]);
  }
  long long ans = 1e18;
  for (long long i = n; i <= 2040; i++) ans = min(ans, dp[i]);
  cout << ans;
}
