#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > pa;
int dp[3005][3005];
int solve(int x, int last) {
  if (x == n) return 0;
  if (dp[last][x] != -1) return dp[last][x];
  return dp[last][x] =
             min(solve(x + 1, x) + pa[x].second,
                 solve(x + 1, last) + abs(pa[x].first - pa[last].first));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int a, b;
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    pa.push_back({a, b});
  }
  sort(pa.begin(), pa.end());
  cout << solve(1, 0) + pa[0].second;
  return 0;
}
