#include <bits/stdc++.h>
using namespace std;
struct point {
  long long x, c;
};
bool cmp(point a, point b) { return a.x < b.x; }
int main() {
  int n;
  scanf("%d", &n);
  point a[n];
  for (int i = 0; i < n; i++) scanf("%I64d%I64d", &a[i].x, &a[i].c);
  sort(a, a + n, cmp);
  long long s[n][n];
  for (int i = 0; i < n; i++) {
    s[i][i] = 0;
    for (int j = i + 1; j < n; j++) s[i][j] = s[i][j - 1] + a[j].x - a[i].x;
  }
  long long d[n];
  for (int i = 0; i < n; i++) d[n - 1] = a[n - 1].c;
  d[n] = 0;
  for (int i = n - 2; i >= 0; i--) {
    d[i] = d[i + 1] + a[i].c;
    for (int j = i; j < n; j++) d[i] = min(d[i], d[j + 1] + s[i][j] + a[i].c);
  }
  printf("%I64d", d[0]);
  return 0;
}
