#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> b[3050];
long long a[3050];
const long long inf = 1 << 29;
int main() {
  long long n, cnt, cost, minv, i, j;
  int N, x, y;
  scanf("%d", &N);
  n = N;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    b[i].first = x;
    b[i].second = y;
  }
  sort(b + 1, b + n + 1);
  n++;
  b[n].first = b[n - 1].first + 1;
  b[n].second = 0;
  a[1] = b[1].second;
  for (i = 2; i <= n; i++) {
    minv = b[i].second + a[i - 1];
    cnt = 0;
    cost = b[i].second;
    for (j = i - 1; j >= 1; j--) {
      cost += cnt * (b[j + 1].first - b[j].first);
      cnt++;
      if (cost + a[j] < minv) minv = cost + a[j];
    }
    a[i] = minv;
  }
  printf("%lld\n", a[n]);
  return 0;
}
