#include <bits/stdc++.h>
using namespace std;
const long long N = 102;
pair<long long, long long> arr[3001];
long long dp[3001][3001];
long long n;
long long fun(long long pos, long long prev) {
  if (pos > n) return (0);
  if (dp[pos][prev] != (-100000000000000007)) return (dp[pos][prev]);
  long long x = arr[pos].second + fun(pos + 1, pos);
  long long y = abs(arr[pos].first - arr[prev].first) + fun(pos + 1, prev);
  return (dp[pos][prev] = min(x, y));
}
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long inv(long long a) {
  a %= 1000000007;
  if (a < 0) a += 1000000007;
  long long b = 1000000007, u = 0, v = 1;
  while (a) {
    long long t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  if (u < 0) u += 1000000007;
  return u;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 0; i <= 3000; i++)
    for (long long j = 0; j <= 3000; j++) dp[i][j] = (-100000000000000007);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> arr[i].first >> arr[i].second;
  sort(arr + 1, arr + n + 1);
  long long ans = fun(2, 1) + arr[1].second;
  cout << ans << endl;
}
