#include <bits/stdc++.h>
using namespace std;
long long N, f[3001][3001];
struct Node {
  long long x, val;
} P[3001];
inline bool cmp(const Node &a, const Node &b) { return a.x < b.x; }
int main() {
  scanf("%I64d", &N);
  for (long long i = 1; i <= N; i++) scanf("%I64d%I64d", &P[i].x, &P[i].val);
  sort(P + 1, P + N + 1, cmp);
  memset(f, 0x7f, sizeof(f));
  f[1][1] = P[1].val;
  for (long long i = 2; i <= N; i++)
    for (long long j = 1; j <= i; j++) {
      f[i][j] = min(f[i][j], f[i - 1][j] + P[i].x - P[j].x);
      f[i][i] = min(f[i][i], f[i - 1][j] + P[i].val);
    }
  long long ans = (unsigned)(-1) >> 1;
  for (long long i = 1; i <= N; i++) ans = min(ans, f[N][i]);
  printf("%I64d\n", ans);
  return 0;
}
