#include <bits/stdc++.h>
using namespace std;
long long dp[2010][4010];
long long renew(long long x, long long y) {
  if (x == -1) return y;
  if (y == -1) return x;
  return min(x, y);
}
int n, t[2010], c[2010];
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d%d", t + i, c + i);
  dp[0][1999] = 0;
  dp[0][2000 + t[0]] = c[0];
  for (int i = 0; i < n - 1; ++i) {
    int now = i + 1;
    for (int j = 0; j <= 4000; ++j) {
      if (dp[i][j] != -1) {
        int y = min(j + t[now], 4000);
        dp[now][y] = renew(dp[now][y], dp[i][j] + c[now]);
        dp[now][j - 1] = renew(dp[now][j - 1], dp[i][j]);
      }
    }
  }
  long long ans = 1e15;
  for (int i = 2000; i <= 4000; ++i) {
    if (dp[n - 1][i] != -1) ans = min(ans, dp[n - 1][i]);
  }
  printf("%I64d\n", ans);
  return 0;
}
