#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> aa[3005];
long long dp[3005][3005];
int main() {
  int n = ({
    int x;
    scanf("%d", &x);
    x;
  });
  for (int i = (1); i < (n + 1); i++) {
    int a = ({
      int x;
      scanf("%d", &x);
      x;
    }),
        b = ({
          int x;
          scanf("%d", &x);
          x;
        });
    aa[i] = make_pair((long long)a, (long long)b);
  }
  sort(aa + 1, aa + n + 1);
  for (int i = (n - 1); i >= (1); i--) {
    dp[n][i] = min(aa[n].second, abs(aa[i].first - aa[n].first));
  }
  for (int i = (n - 1); i >= (2); i--) {
    for (int j = (i - 1); j >= (1); j--) {
      dp[i][j] = min(dp[i + 1][i] + aa[i].second,
                     dp[i + 1][j] + abs(aa[i].first - aa[j].first));
    }
  }
  cout << dp[2][1] + aa[1].second;
  return 0;
}
