#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[3001];
const long long int INF = 1000000000000000;
int n;
long long int dp[3001][3001];
long long int solve(int pos, int prev) {
  if (pos > n) return 0;
  if (dp[pos][prev] != -INF) return dp[pos][prev];
  long long int pin = arr[pos].second + solve(pos + 1, pos);
  long long int unpin =
      abs(arr[prev].first - arr[pos].first) + solve(pos + 1, prev);
  return dp[pos][prev] = min(pin, unpin);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  sort(arr + 1, arr + n + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) dp[i][j] = -INF;
  }
  long long int ans = arr[1].second + solve(2, 1);
  cout << ans << "\n";
  return 0;
}
