#include <bits/stdc++.h>
using namespace std;
const int MX = 3000;
int pos[MX + 10];
int penalty[MX + 10];
long long penalty2[MX + 10][MX + 10];
int bestf[MX + 10];
int N;
long long memo[MX + 10][MX + 10];
int visited[MX + 10][MX + 10];
long long doit(int p, int fix) {
  if (!visited[p][fix]) {
    long long res = 0;
    if (p == fix) {
      res = penalty[p];
      if (p >= 1) {
        if (bestf[p - 1] == -1) {
          long long best_res = LONG_LONG_MAX;
          for (int(i) = 0; (i) < (p); ++(i)) {
            long long res1 = doit(p - 1, i);
            if (res1 < best_res) {
              best_res = res1;
              bestf[p - 1] = i;
            }
          }
        }
        res += doit(p - 1, bestf[p - 1]);
      }
    } else {
      res = penalty2[fix][p];
      res += doit(fix, fix);
    }
    memo[p][fix] = res;
  }
  visited[p][fix] = 1;
  return memo[p][fix];
}
int main() {
  cin >> N;
  vector<pair<int, int> > vpii;
  for (int(i) = 0; (i) < (N); ++(i)) {
    int x, y;
    cin >> x >> y;
    vpii.push_back(make_pair(x, y));
  }
  sort((vpii).begin(), (vpii).end());
  vpii.push_back(make_pair(vpii[(vpii).size() - 1].first, 0));
  ++N;
  for (int(i) = 0; (i) < (N); ++(i)) {
    pos[i] = vpii[i].first;
    penalty[i] = vpii[i].second;
  }
  for (size_t i = 0; i < N; ++i) {
    penalty2[i][i] = 0;
    long long p = 0;
    for (size_t j = i + 1; j < N; ++j) {
      p += pos[j] - pos[i];
      penalty2[i][j] = p;
    }
  }
  memset(visited, 0, sizeof(visited));
  memset(bestf, -1, sizeof(bestf));
  memo[0][0] = penalty[0];
  bestf[0] = 0;
  visited[0][0] = 1;
  cout << doit(N, N) << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
