#include <bits/stdc++.h>
using namespace std;
long long int input(long long int n, vector<long long int> &ve);
long long int input(long long int n, vector<long long int> &ve) {
  long long int val;
  for (long long int i = 0; i < n; i++) {
    cin >> val;
    ve.push_back(val);
  }
  return 0;
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, x, c;
  vector<pair<long long int, long long int>> v;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> x >> c;
    v.push_back({x, c});
  }
  vector<long long int> pref(n + 2, 0);
  sort(v.begin(), v.end());
  for (long long int i = 1; i < n; i++) {
    pref[i] = pref[i - 1] + v[i].first - v[0].first;
  }
  vector<vector<long long int>> dp(n + 2, {0, 0});
  dp[0][0] = 1e15;
  dp[0][1] = v[0].second;
  for (long long int i = 1; i < n; i++) {
    dp[i][1] = min(dp[i - 1][1], dp[i - 1][0]) + v[i].second;
    long long int p = 1e15;
    for (long long int j = 0; j < i; j++) {
      long long int a =
          dp[j][1] + pref[i] - pref[j] - (v[j].first - v[0].first) * (i - j);
      p = min(p, a);
    }
    dp[i][0] = p;
  }
  cout << min(dp[n - 1][1], dp[n - 1][0]) << endl;
  return 0;
}
