#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int sum, suf, pre, max;
} Node;
int toint(const string &s) {
  stringstream ss;
  ss << s;
  int x;
  ss >> x;
  return x;
}
const int N = 1e4 + 10;
const int inf = 1e9;
const int lim = 1e18 + 1;
const int mod = 1e9 + 7;
const double pi = 3.141592653589793238462643383;
const int M = 1e6 + 10;
const double Phi = 1.618033988749894;
const int logn = 20;
const double phi = 0.618033988749894;
const double root5 = 2.236067977;
int n, m;
long long int dp[3010][3010];
pair<long long int, long long int> mas[3010];
long long int get(int id, int l) {
  if (id == n) return 0;
  long long int &ans = dp[id][l];
  if (ans != -1) return ans;
  ans = min(mas[id].second + get(id + 1, id),
            get(id + 1, l) + abs(mas[id].first - mas[l].first));
  return ans;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> mas[i].first >> mas[i].second;
  }
  sort(mas, mas + n);
  memset(dp, -1, sizeof(dp));
  cout << (get(1, 0) + mas[0].second) << endl;
  return 0;
}
