#include <bits/stdc++.h>
using namespace std;
int main() {
  long long inf = 1000000000;
  inf *= inf;
  long long n;
  cin >> n;
  vector<pair<long long, long long> > a(n);
  for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;
  sort((a).begin(), (a).end());
  vector<long long> x(n), c(n);
  for (long long i = 0; i < n; ++i) {
    x[i] = a[i].first;
    c[i] = a[i].second;
  }
  vector<long long> res1(n, inf), res2(n, inf);
  res1[0] = c[0];
  for (long long i = 1; i < n; ++i) {
    res1[i] = c[i] + min(res1[i - 1], res2[i - 1]);
    long long sum = 0;
    for (long long j = i - 1; j >= 0; --j) {
      sum += (x[j + 1] - x[j]) * (i - j);
      res2[i] = min(res2[i], res1[j] + sum);
    }
  }
  cout << min(res1[n - 1], res2[n - 1]) << endl;
  return 0;
}
