#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%u", &n);
  pair<int, int> xc[3000];
  for (int i = 0; i < n; ++i) scanf("%i%i", &xc[i].first, &xc[i].second);
  sort(xc, xc + n);
  long long m[3000], d[3000];
  m[0] = xc[0].second;
  d[0] = 0;
  for (int i = 1; i < n; ++i) {
    long long moverall = LLONG_MAX;
    for (int j = 0; j < i; ++j) {
      moverall = min(moverall, m[j]);
      d[j] += xc[i].first - xc[i - 1].first;
      m[j] += d[j];
    }
    m[i] = moverall + xc[i].second;
    d[i] = 0;
  }
  long long moverall = LLONG_MAX;
  for (int i = 0; i < n; ++i) moverall = min(moverall, m[i]);
  printf("%lli\n", moverall);
  return 0;
}
