#include <bits/stdc++.h>
using namespace std;
struct ball {
  long long c, x;
};
const long long INF = 100000000000000000;
ball balls[3001];
int n;
long long d[3001];
bool ball_sort(ball b1, ball b2) { return (b1.x < b2.x); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d %I64d", &balls[i].x, &balls[i].c);
  }
  sort(balls, balls + n, &ball_sort);
  d[n] = 0;
  d[n - 1] = balls[n - 1].c;
  for (int i = n - 2; i >= 0; i--) {
    d[i] = INF;
    long long s = 0;
    for (int j = i; j < n; j++) {
      s += balls[j].x - balls[i].x;
      if (d[i] > s + d[j + 1]) {
        d[i] = s + d[j + 1];
      }
    }
    d[i] += balls[i].c;
  }
  printf("%I64d\n", d[0]);
  return 0;
}
