#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > arr;
long long dp[3010][3010];
int n;
long long rec(int pos, int prev) {
  if (pos == n) return 0;
  long long &ans = dp[pos][prev];
  if (ans == -1) {
    long long a = rec(pos + 1, pos) + arr[pos].second;
    long long b = rec(pos + 1, prev) + arr[pos].first - arr[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;
    arr.push_back({a, b});
  }
  sort(arr.begin(), arr.end());
  memset(dp, -1, sizeof dp);
  cout << rec(1, 0) + arr[0].second << endl;
  return 0;
}
