#include <bits/stdc++.h>
using namespace std;
const long long int MAXN = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> x(n + 1), c(n + 1);
  for (int i = 1; i <= n; i++) cin >> x[i] >> c[i];
  vector<pair<long long int, long long int> > v;
  for (int i = 1; i <= n; i++) v.push_back({x[i], c[i]});
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    x[i + 1] = v[i].first;
    c[i + 1] = v[i].second;
  }
  long long int dp[n + 1][2];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < 2; j++) dp[i][j] = 1e18;
  }
  dp[1][1] = c[1];
  for (int i = 2; i <= n; i++) {
    dp[i][1] = c[i] + min(dp[i - 1][0], dp[i - 1][1]);
    long long int sum = x[i], cnt = 1;
    for (int j = i - 1; j >= 1; j--) {
      dp[i][0] = min(dp[i][0], dp[j][1] + sum - cnt * x[j]);
      sum += x[j];
      cnt++;
    }
    dp[i][0] = min(dp[i][0], dp[i - 1][1] + abs(x[i] - x[i - 1]));
  }
  cout << min(dp[n][0], dp[n][1]) << endl;
}
