#include <bits/stdc++.h>
using namespace std;
const long long INF = 999999999;
struct ball {
  long long x;
  long long c;
};
int main() {
  int n;
  cin >> n;
  vector<ball> s(n);
  for (int i = 0; i < n; ++i) cin >> s[i].x >> s[i].c;
  for (int i = 0; i < n - 1; ++i)
    for (int j = i + 1; j < n; ++j)
      if (s[i].x > s[j].x) swap(s[i], s[j]);
  vector<long long> f(n + 1, INF);
  f[0] = 0;
  long long sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum = 0;
    f[i] = f[i - 1] + s[i - 1].c;
    for (int j = i - 2; j >= 0; --j) {
      sum += (s[j + 1].x - s[j].x) * (i - 1 - j);
      f[i] = min(f[j] + s[j].c + sum, f[i]);
    }
  }
  cout << f[f.size() - 1] << endl;
  return 0;
}
