#include <bits/stdc++.h>
using namespace std;
struct A {
  long long x, w;
} a[3100];
long long dp[3100];
bool cmp(A x, A y) { return x.x < y.x; }
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].w;
  }
  sort(a + 1, a + n + 1, cmp);
  dp[1] = a[1].w;
  int bef = 1;
  for (int i = 2; i <= n; i++) {
    dp[i] = dp[i - 1] + a[i].w;
    long long tmp = 0;
    for (int j = i - 1; j >= 1; j--) {
      tmp += (a[j + 1].x - a[j].x) * (i - j);
      dp[i] = min(dp[i], dp[j - 1] + tmp + a[j].w);
    }
  }
  cout << dp[n] << endl;
}
