#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> balls(1 + n);
  balls[0] = {-1000000001, 0};
  long long sum_coordinates = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> balls[i].first >> balls[i].second;
    sum_coordinates += balls[i].first;
  }
  sort(balls.begin(), balls.end());
  vector<long long> dp(1 + n, INF);
  dp[1] = sum_coordinates - 1LL * n * balls[1].first + balls[1].second;
  for (int last_pos = 2; last_pos <= n; ++last_pos) {
    for (int prev_pos = 1; prev_pos < last_pos; ++prev_pos) {
      dp[last_pos] = min(dp[last_pos], dp[prev_pos] -
                                           1LL * (n - last_pos + 1) *
                                               (balls[last_pos].first -
                                                balls[prev_pos].first) +
                                           balls[last_pos].second);
    }
  }
  long long min_cost = INF;
  for (int i = 1; i <= n; ++i) {
    min_cost = min(min_cost, dp[i]);
  }
  cout << min_cost << endl;
  return 0;
}
