#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<long long, long long> > pearl;
long long memo[4000][4000], length, cost;
long long DP(int index, int last_pin) {
  if (index == n) return 0;
  if (memo[index][last_pin] != -1) return memo[index][last_pin];
  return memo[index][last_pin] =
             min(DP(index + 1, last_pin) +
                     abs(pearl[index].first - pearl[last_pin].first),
                 DP(index + 1, index) + pearl[index].second);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> length >> cost;
    pearl.push_back(make_pair(length, cost));
  }
  sort(pearl.begin(), pearl.end());
  memset(memo, -1, sizeof memo);
  cout << DP(1, 0) + pearl[0].second << endl;
  return 0;
}
