#include <bits/stdc++.h>
long long mini(long long x, long long y) { return (x < y) ? x : y; }
long long dp[2018][4018];
long long t[2018], c[2018];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &t[i], &c[i]);
    t[i]++;
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 4000; j++) {
      dp[i][j] = 100100100010001;
    }
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < t[i - 1]; j++) dp[i][j] = dp[i - 1][j];
    for (int j = t[i - 1]; j <= 4000; j++) {
      dp[i][j] = mini(dp[i - 1][j], dp[i - 1][j - t[i - 1]] + c[i - 1]);
    }
  }
  long long sol = 100100100010001;
  for (int j = n; j <= 4000; j++) {
    sol = mini(sol, dp[n][j]);
  }
  printf("%lld", sol);
  return 0;
}
