#include <bits/stdc++.h>
using namespace std;
void run() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int n;
pair<int, int> a[3005];
long long mem[3005][3005];
long long solve(int index, int prv) {
  if (index == n) return 0;
  long long &ret = mem[index][prv];
  if (ret != -1) return ret;
  long long leave = solve(index + 1, prv) + abs(a[index].first - a[prv].first);
  long long place = solve(index + 1, index) + a[index].second;
  ret = min(place, leave);
  return ret;
}
int main() {
  run();
  cin >> n;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) mem[i][j] = -1;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  sort(a, a + n);
  cout << solve(1, 0) + a[0].second << endl;
  return 0;
}
