#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int IINF = 1000000000;
const double PI = acos(-1.0);
const long long LINF = 6000000000000000000LL;
int n;
long long dp[3333][3333];
vector<pair<int, int> > a;
long long go(int pos, int prev) {
  if (pos == n) {
    return 0;
  }
  long long& ref = dp[pos][prev];
  if (ref != -1) return ref;
  ref = LINF;
  ref = min(ref, a[pos].first - a[prev].first + go(pos + 1, prev));
  ref = min(ref, a[pos].second + go(pos + 1, pos));
  return ref;
}
int main() {
  while (scanf("%d", &n) == 1) {
    vector<pair<int, int> > v(n);
    for (int i = 0; i < n; ++i) {
      scanf("%d%d", &v[i].first, &v[i].second);
    }
    sort(v.begin(), v.end());
    a = v;
    memset(dp, -1, sizeof(dp));
    printf("%I64d\n", go(1, 0) + v[0].second);
  }
  return 0;
}
