#include <bits/stdc++.h>
using namespace std;
long long int p = 1000000007;
int main() {
  long long int n;
  cin >> n;
  pair<long long int, long long int> a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + n);
  long long int m[n], me[n];
  long long int dist[n];
  dist[0] = a[0].first;
  for (long long int i = 1; i < n; i++) {
    dist[i] = dist[i - 1] + a[i].first;
  }
  if (n == 1) {
    cout << a[0].second << endl;
    return 0;
  }
  me[0] = m[0] = 0;
  me[1] = a[1].second;
  m[1] = min(me[1], a[1].first - a[0].first);
  for (long long int i = 2; i < n; i++) {
    me[i] = a[i].second + m[i - 1];
    m[i] = me[i];
    for (long long int j = i - 1; j >= 0; j--) {
      if (me[j] + dist[i] - dist[j] - (i - j) * (a[j].first) < m[i]) {
        m[i] = me[j] + dist[i] - dist[j] - (i - j) * (a[j].first);
      }
    }
  }
  cout << m[n - 1] + a[0].second << endl;
}
