#include <bits/stdc++.h>
using namespace std;
int x[1000000], c[1000000], dp[3001][3001];
vector<pair<int, int> > vp;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> c[i];
    vp.push_back(pair<int, int>(x[i], c[i]));
  }
  sort(vp.begin(), vp.end());
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      int hi = abs(vp[j].first - vp[i].first);
      if (i != 0)
        dp[i][j] = min(dp[i + 1][j] + hi, dp[i + 1][i] + vp[i].second);
      else
        dp[i][j] = dp[i + 1][i] + vp[i].second;
    }
  }
  cout << dp[0][0];
  return 0;
}
