#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<pair<long long, long long>> marbles(n);
  for (int i = 0; i < n; ++i) {
    cin >> marbles[i].first >> marbles[i].second;
  }
  sort(marbles.begin(), marbles.end());
  vector<long long> min_cost(n);
  {
    min_cost[0] = marbles[0].second;
    long long dist = 0;
    for (int i = 1; i < n; ++i) {
      dist += (marbles[i].first - marbles[0].first);
      min_cost[i] = min_cost[0] + dist;
    }
  }
  for (int i = 1; i < n; ++i) {
    long long min_c = min_cost[i - 1] + marbles[i].second;
    min_cost[i] = min(min_cost[i], min_c);
    long long dist = 0;
    for (int j = i + 1; j < n; ++j) {
      dist += (marbles[j].first - marbles[i].first);
      min_cost[j] = min(min_cost[j], min_c + dist);
    }
  }
  cout << min_cost[n - 1] << '\n';
  return 0;
}
