#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int promena[3002];
long long d[3001], s[3002][3002], pom;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int j, n, i, x, p;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x >> p;
    v.push_back(make_pair(x, p));
  }
  sort(v.begin(), v.end());
  d[n - 1] = v[n - 1].second;
  for (i = 0; i < n - 1; i++)
    for (j = i + 1; j < n; j++)
      s[i][j] = s[i][j - 1] + (long long)v[j].first - v[i].first;
  for (i = n - 2; i >= 0; i--) {
    for (j = i; j < n; j++) {
      pom = d[j + 1] + s[i][j] + (long long)v[i].second;
      if (promena[i] == 0) {
        d[i] = pom;
        promena[i] = 1;
      } else {
        if (d[i] > pom) d[i] = pom;
      }
    }
  }
  cout << d[0];
  return 0;
}
