#include <bits/stdc++.h>
using namespace std;
const long long mx = 3e3 + 5;
pair<long long, long long> a[mx];
long long n;
long long dp[mx][mx];
long long solve(long long pos, long long pre) {
  if (pos > n) return 0;
  if (dp[pos][pre] != -LLONG_MAX) return dp[pos][pre];
  long long x = a[pos].second + solve(pos + 1, pos);
  long long y = abs(a[pos].first - a[pre].first) + solve(pos + 1, pre);
  return dp[pos][pre] = min(x, y);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  for (long long i = 0; i < mx; i++) {
    for (long long j = 0; j < mx; j++) {
      dp[i][j] = -LLONG_MAX;
    }
  }
  cin >> n;
  for (long long i = 1; i < n + 1; i++) cin >> a[i].first >> a[i].second;
  sort(a + 1, a + n + 1);
  cout << solve(2, 1) + a[1].second;
  return 0;
}
