#include <bits/stdc++.h>
using namespace std;
const long long N = 3e3 + 5;
array<pair<long long, long long>, N> v;
long long n;
const long long inf = 1e18;
long long mem[N][N][2];
bool seen[N][N][2];
long long calc(long long i, long long last, bool stopped = false) {
  if (i >= n) return 0;
  long long ans = inf;
  if (seen[i][last][stopped]) return mem[i][last][stopped];
  seen[i][last][stopped] = true;
  if (stopped) {
    long long op1 = v[i].second + calc(i + 1, i, true);
    long long op2 = (v[i].first - v[last].first) + calc(i + 1, last, true);
    ans = min(op1, op2);
  } else {
    ans = v[i].second + calc(i + 1, i, true);
  }
  return mem[i][last][stopped] = ans;
}
void solve() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  sort(v.begin(), v.begin() + n);
  long long ans = calc(0, 0, false);
  cout << ans << '\n';
}
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();
  return 0;
}
