#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> ar[3001];
const long long INF = 1000000000000000;
long long dp[3001][3001];
int func(int pos, int pre) {
  if (pos > n) return 0;
  if (dp[pos][pre] != -INF) return dp[pos][pre];
  int x = ar[pos].second + func(pos + 1, pos);
  int y = abs(ar[pos].first - ar[pre].first) + func(pos + 1, pre);
  return dp[pos][pre] = min(x, y);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> ar[i].first >> ar[i].second;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) dp[i][j] = -INF;
  }
  sort(ar + 1, ar + n + 1);
  long long ans = func(2, 1) + ar[1].second;
  cout << ans << endl;
}
