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