#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
const int N = 3005;
const long long INF = 1000000000000000;
long long dp[N][N];
long long a[N], sum[N];
int n, x, y;
pair<int, int> p[N];
long long cnt(int idx, int last) {
  if (idx > n) return 0;
  if (dp[idx][last] != -INF) return dp[idx][last];
  long long x = p[idx].second + cnt(idx + 1, idx);
  long long y = abs(p[idx].first - p[last].first) + cnt(idx + 1, last);
  return dp[idx][last] = min(x, y);
}
void solve() {
  cin >> n;
  for (long long i = 1; i < n + 1; i++) {
    cin >> x >> y;
    p[i] = {x, y};
  }
  sort(p + 1, p + 1 + n);
  for (long long i = 0; i < n + 3; i++) {
    for (long long j = 0; j < n + 3; j++) {
      dp[i][j] = -INF;
    }
  }
  cout << cnt(2, 1) + p[1].second << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
}
