#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<long long int, long long int> > a;
vector<vector<long long int> > dp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  a.resize(n);
  dp.assign(n, vector<long long int>(n, 0));
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    dp[i][i] = a[i].second;
    for (int j = i + 1; j < n; ++j) {
      dp[i][j] = dp[i][j - 1] + a[j].first - a[i].first;
    }
  }
  vector<long long int> ans(n);
  for (int i = 0; i < n; ++i) ans[i] = dp[0][i];
  for (int i = 1; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      ans[j] = min(ans[i - 1] + dp[i][j], ans[j]);
    }
  }
  cout << ans[n - 1];
  return 0;
}
