#include <bits/stdc++.h>
const int maxn = 2003;
int n, t[maxn];
long long c[maxn], dp[2][maxn * 2];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%I64d", t + i, c + i);
  memset(dp[0], 1, sizeof(dp[0]));
  dp[0][maxn] = 0;
  for (int i = 1; i <= n; ++i) {
    memset(dp[i & 1], 1, sizeof(dp[i & 1]));
    for (int j = 0; j < maxn * 2; ++j) {
      if (j + 1 < maxn * 2)
        dp[i & 1][j] = std::min(dp[i & 1][j], dp[~i & 1][j + 1]);
      if (j - t[i] >= 0)
        dp[i & 1][j] = std::min(dp[i & 1][j], dp[~i & 1][j - t[i]] + c[i]);
    }
  }
  long long ans = 0x7fffffffffffffff;
  for (int i = maxn; i < maxn * 2; ++i) ans = std::min(ans, dp[n & 1][i]);
  printf("%I64d\n", ans);
  return 0;
}
