#include <bits/stdc++.h>
using namespace std;
int input() {
  int res = 0, m = 1;
  char c = ' ';
  while (c < '0' && c != '-') c = getchar();
  if (c == '-') m = -1, c = getchar();
  while (c >= '0') res = res * 10 + (c - '0'), c = getchar();
  return res * m;
}
const int N = 3e3 + 1;
long long x[N], c[N], f[N][N];
pair<long long, long long> p[N];
int main() {
  int n = input();
  for (int i = 0; i < n; ++i) p[i] = {x[i] = input(), c[i] = input()};
  sort(p, p + n);
  for (int i = 0; i < n; ++i) x[i] = p[i].first, c[i] = p[i].second;
  f[0][0] = c[0];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= i; ++j) {
      if (!(i | j)) continue;
      f[i][j] = 1e15;
      if (j == i) {
        for (int k = 0; k < j; ++k) f[i][j] = min(f[i][j], f[i - 1][k] + c[j]);
      } else
        f[i][j] = f[i - 1][j] + x[i] - x[j];
    }
  }
  long long ans = 1e13;
  for (int j = 0; j < n; ++j) ans = min(ans, f[n - 1][j]);
  cout << ans;
}
