#include <bits/stdc++.h>
const long long int inf = 1e15;
const int M = 1e9 + 7;
using namespace std;
long long int n;
std::vector<pair<long long int, long long int> > v;
long long int was[4000][4000];
long long int table[4000][4000];
int solve(int curr, int prev) {
  if (curr == n) return 0;
  long long int ans = inf;
  if (!was[curr][curr]) {
    was[curr][curr] = 1;
    table[curr][curr] = v[curr].second + solve(curr + 1, curr);
  }
  if (!was[curr][prev]) {
    was[curr][prev] = 1;
    table[curr][prev] = v[curr].first - v[prev].first + solve(curr + 1, prev);
  }
  return min(table[curr][prev], table[curr][curr]);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long long int x, c;
    cin >> x >> c;
    v.push_back(make_pair(x, c));
  }
  sort(v.begin(), v.end());
  cout << v[0].second + solve(1, 0) << endl;
  return 0;
}
