#include <bits/stdc++.h>
using namespace std;
long long n, dp[3005][3005];
vector<pair<long long, long long>> arr;
long long solve(long long pos, long long lp) {
  if (pos > n) return 0;
  if (dp[pos][lp] != -30000000000000) return dp[pos][lp];
  return dp[pos][lp] = min(solve(pos + 1, lp) + arr[pos].first - arr[lp].first,
                           solve(pos + 1, pos) + arr[pos].second);
}
int main() {
  for (int i = 0; i <= 3002; i++)
    for (int j = 0; j <= 3002; j++) dp[i][j] = -30000000000000;
  cin >> n;
  arr.push_back({-10000000000, 0});
  for (int i = 1; i <= n; i++) {
    long long a, b;
    cin >> a >> b;
    arr.push_back(make_pair(a, b));
  }
  sort(arr.begin(), arr.end());
  cout << solve(2, 1) + arr[1].second;
  return 0;
}
