#include <bits/stdc++.h>
using namespace std;
template <typename T, typename V>
void bugp(const pair<T, V> &x) {
  cerr << '{' << x.first << ", " << x.second << '}' << endl;
}
template <typename T, typename U, typename V>
void bugpp(const pair<T, pair<U, V> > &x) {
  cerr << '{' << x.first << ", {" << x.second.first << ", " << x.second.second
       << "}}" << endl;
}
template <typename T>
bool maximize(T &x, const T &y) {
  if (x < y) {
    x = y;
    return 1;
  }
  return 0;
}
template <typename T>
bool minimize(T &x, const T &y) {
  if (x > y) {
    x = y;
    return 1;
  }
  return 0;
}
const int N = 3003;
const long long INF = (long long)1e18;
int n;
long long dp[N];
pair<int, int> arr[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0, _n = (n); i < _n; ++i) cin >> arr[i].first >> arr[i].second;
  sort(arr, arr + n);
  dp[0] = arr[0].second;
  long long cost, sum;
  int num;
  for (int i = 1, _n = (n - 1); i <= _n; ++i) {
    num = sum = 0;
    cost = INF;
    for (int j = (i)-1; j >= 0; --j) {
      sum += (long long)num * (arr[j + 1].first - arr[j].first);
      minimize(cost, dp[j] + sum);
      ++num;
    }
    dp[i] = arr[i].second + cost;
  }
  long long ans = INF;
  sum = num = 0;
  for (int i = (n)-1; i >= 0; --i) {
    sum += (long long)num * (arr[i + 1].first - arr[i].first);
    minimize(ans, dp[i] + sum);
    ++num;
  }
  cout << ans;
  return 0;
}
