#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vec;
long long dp[3010][3010];
int n;
long long call(int pos, int prev) {
  if (pos == n) return 0;
  long long &ans = dp[pos][prev];
  if (ans == -1) {
    long long a = call(pos + 1, pos) + vec[pos].second;
    long long b = call(pos + 1, prev) + vec[pos].first - vec[prev].first;
    ans = min(a, b);
  }
  return ans;
}
int main() {
  int i, a, b;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    vec.push_back(make_pair(a, b));
  }
  sort(vec.begin(), vec.end());
  memset(dp, -1, sizeof dp);
  cout << call(1, 0) + vec[0].second << endl;
  return 0;
}
