#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x, cost;
} p[3333];
long long dp[3333][3333];
bool cp(node x1, node y) { return x1.x < y.x; }
int main() {
  int n, l;
  while (cin >> n) {
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; i++) {
      cin >> p[i].x >> p[i].cost;
    }
    sort(p, p + n, cp);
    for (int i = 0; i < n - 1; i++) dp[n - 1][i] = p[n - 1].x - p[i].x;
    dp[n - 1][n - 1] = p[n - 1].cost;
    for (int i = n - 2; i >= 0; i--) {
      for (int j = i; j >= 0; j--) {
        if (i == j) {
          dp[i][j] = min(dp[i + 1][j + 1], dp[i + 1][j]) + p[i].cost;
        } else
          dp[i][j] = min(dp[i + 1][j] + p[i].x - p[j].x,
                         dp[i + 1][i + 1] + p[i].x - p[j].x);
      }
    }
    cout << dp[0][0] << endl;
  }
  return 0;
}
