#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 2000, inf = 1000000000000000;
inline long long read() {
  char ch = getchar();
  long long f = 1, x = 0;
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, Max, ans = inf;
long long t[Maxn + 5], c[Maxn + 5], f[Maxn * 2 + 5];
signed main() {
  n = read();
  for (register long long i = 1; i <= n; ++i)
    t[i] = read() + 1, c[i] = read(), Max = max(Max, t[i]);
  Max += n;
  for (register long long i = 1; i <= Max; ++i) f[i] = inf;
  for (register long long i = 1; i <= n; ++i)
    for (register long long j = Max; j >= 0; --j) {
      if (j >= t[i]) f[j] = min(f[j], f[j - t[i]] + c[i]);
    }
  for (register long long i = n; i <= Max; ++i) ans = min(ans, f[i]);
  printf("%lld", ans);
  return 0;
}
