#include <bits/stdc++.h>
using namespace std;
long long n;
pair<long long, long long> p[3005];
long long dp[3005][3005];
long long DP(long long i, long long old) {
  if (i == n + 1) return 0;
  long long &ret = dp[i][old];
  if (ret != -1) return ret;
  ret = min(DP(i + 1, old) + abs(p[i].first - p[old].first),
            DP(i + 1, i) + p[i].second);
  return ret;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> p[i].first >> p[i].second;
  sort(p + 1, p + n + 1);
  memset(dp, -1, sizeof(dp));
  cout << DP(2, 1) + p[1].second << endl;
  return 0;
}
