#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > a(n + 1);
  for (long long i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  a[n] = make_pair(2000000000, 0);
  sort(a.begin(), a.end());
  long long f[5000];
  for (long long i = 0; i < 5000; i++) f[i] = 1000 * 1000 * 1000;
  for (long long i = 0; i < 5000; i++) f[i] *= 1000 * 1000 * 1000;
  f[0] = a[0].second;
  long long inf = 1000 * 1000 * 1000;
  inf *= 1000 * 1000 * 1000;
  for (long long i = 1; i <= n; i++) {
    long long mi = inf;
    long long we = 0;
    for (long long j = 1; j < i; j++) we += a[j].first - a[0].first;
    for (long long j = 0; j < i; j++) {
      mi = min(mi, we + f[j]);
      we -= (i - j - 1) * (a[j + 1].first - a[j].first);
    }
    f[i] = mi + a[i].second;
  }
  cout << f[n];
  return 0;
}
