#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > a(n);
  for (int i = (0); i < ((n)); ++i) cin >> a[i].first >> a[i].second;
  sort(a.begin(), a.end());
  long long best = -1;
  vector<long long> dp(n, 0);
  for (int i = n - 1; i >= 0; --i) {
    dp[i] = -1;
    long long prev = 0;
    for (int j = i; j < n; ++j) {
      prev += a[j].first - a[i].first;
      long long cost = a[i].second + prev + (j == n - 1 ? 0 : dp[j + 1]);
      if (dp[i] == -1 || dp[i] > cost) {
        dp[i] = cost;
      }
    }
    if (dp[i] == -1) dp[i] = a[i].second;
  }
  cout << dp[0] << "\n";
  return 0;
}
