#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, c;
} a[4003];
long long dp[4003];
bool cmp(node a, node b) { return a.x < b.x; }
int main() {
  long long sss, te, te2, ans;
  int n, i, j;
  while (~scanf("%d", &n)) {
    for (i = 0; i < n; i++) scanf("%d%d", &a[i].x, &a[i].c);
    if (n == 1) {
      printf("%d\n", a[0].c);
      continue;
    }
    sort(a, a + n, cmp);
    for (sss = 0, i = 0; i < n; i++) sss += (a[i].x - a[0].x);
    dp[0] = a[0].c + sss, ans = dp[0];
    for (i = 1; i < n; i++) {
      te = dp[0] -
           (long long)((long long)(n - i) * (long long)(a[i].x - a[0].x)) +
           (long long)a[i].c;
      for (j = 1; j < i; j++) {
        te2 = dp[j] -
              (long long)((long long)(n - i) * (long long)(a[i].x - a[j].x)) +
              (long long)a[i].c;
        te = (te2 < te ? te2 : te);
      }
      dp[i] = te;
      ans = (dp[i] < ans ? dp[i] : ans);
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
