#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1000000000000000;
string s;
vector<long long> prim;
set<long long> prim2;
void primeFactors(int n) {
  while (n % 2 == 0) {
    prim.push_back(2);
    prim2.insert(2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      prim.push_back(i);
      prim2.insert(i);
      n = n / i;
    }
  }
  if (n > 2) {
    prim.push_back(n);
    prim2.insert(n);
  }
}
long long dp[3001][3001];
long long n;
pair<long long, long long> arr[4000];
long long get_ans(long long i, long long prev) {
  if (i > n) {
    return 0;
  }
  if (dp[i][prev] != -inf) return dp[i][prev];
  long long x = 0, y = 0;
  x = get_ans(i + 1, i) + arr[i].second;
  y = abs(arr[prev].first - arr[i].first) + get_ans(i + 1, prev);
  return dp[i][prev] = min(x, y);
}
void func() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long a, b;
    cin >> a >> b;
    arr[i] = {a, b};
  }
  sort(arr + 1, arr + n + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      dp[i][j] = -inf;
    }
  }
  cout << get_ans(2, 1) + arr[1].second << "\n";
}
int main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  }
  { func(); }
  return 0;
}
