#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<long long int, long long int> > a;
vector<vector<long long int> > dp;
long long int solve(int p, int i) {
  if (i == n) return 0;
  if (dp[p][i] != -1) return dp[p][i];
  return dp[p][i] = min(solve(i, i + 1) + a[i].second,
                        solve(p, i + 1) + a[i].first - a[p].first);
}
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, -1));
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(), a.end());
  cout << solve(0, 1) + a[0].second;
  return 0;
}
