#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      f = -1;
      ch = getchar();
    }
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const long long MAXN = 3010;
long long n;
long long f[MAXN][MAXN];
struct balls {
  long long x, c;
} a[MAXN];
bool cmp(balls x, balls y) { return x.x < y.x; }
signed main() {
  n = read();
  for (long long i = 1; i <= n; ++i) {
    a[i].x = read(), a[i].c = read();
  }
  sort(a + 1, a + 1 + n, cmp);
  long long minn;
  f[1][1] = a[1].c;
  for (long long i = 2; i <= n; ++i) {
    minn = 1e19;
    for (long long j = 1; j < i; ++j) {
      f[i][j] = f[i - 1][j] + a[i].x - a[j].x;
      minn = min(minn, f[i - 1][j]);
    }
    f[i][i] = minn + a[i].c;
  }
  long long ans = 1e19;
  for (long long i = 1; i <= n; ++i) {
    ans = min(ans, f[n][i]);
  }
  cout << ans << endl;
  return 0;
}
