#include <bits/stdc++.h>
using namespace std;
inline void fastio() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
inline void setPrecision(int n) { cout.precision(n); }
long long int INF = 1e10;
int MOD = 1e9 + 7;
vector<pair<int, int>> m;
vector<vector<long long int>> dp;
long long int cost(int idx, int nearestPin) {
  if (idx == m.size() - 1) {
    if (nearestPin == idx)
      return m[idx].second;
    else
      return m[idx].first - m[nearestPin].first;
  }
  if (dp[idx][nearestPin] != -1) return dp[idx][nearestPin];
  if (nearestPin == idx) {
    dp[idx][nearestPin] =
        m[idx].second + min(cost(idx + 1, idx + 1), cost(idx + 1, idx));
    return dp[idx][nearestPin];
  } else {
    dp[idx][nearestPin] =
        m[idx].first - m[nearestPin].first +
        min(cost(idx + 1, idx + 1), cost(idx + 1, nearestPin));
    return dp[idx][nearestPin];
  }
}
int main() {
  fastio();
  int n;
  cin >> n;
  m.clear();
  dp.resize(n, vector<long long int>(n, -1));
  for (int i = 0; i < n; ++i) {
    int x, c;
    cin >> x >> c;
    m.push_back({x, c});
  }
  sort(m.begin(), m.end());
  cout << cost(0, 0);
  return 0;
}
