#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > d;
long long r[3003][3003];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < 3003; i++) r[0][i] = 0;
  int t1, t2;
  for (int i = 0; i < n; i++) {
    cin >> t1 >> t2;
    d.push_back(make_pair(t1, t2));
  }
  sort(d.rbegin(), d.rend());
  for (int i = 0; i < n + 2; i++) r[0][i] = 0;
  r[0][0] = d[0].second;
  for (int i = 1; i < n; i++) {
    int dist = abs(d[i - 1].first - d[i].first);
    r[i][0] = r[i - 1][0];
    for (int j = 0; j <= i; j++) {
      r[i][0] = min(r[i - 1][j] + (long long)(j) * (dist), r[i][0]);
    }
    r[i][0] += d[i].second;
    for (int j = 1; j < i + 2; j++) {
      r[i][j] = r[i - 1][j - 1] + (long long)(j - 1) * dist;
    }
  }
  cout << r[n - 1][0] << endl;
  return 0;
}
