#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > p;
long long n;
long long dp[3001][3001];
long long solve(long long ind, long long pos) {
  if (ind == n) return 0;
  if (dp[ind][pos] != -1) return dp[ind][pos];
  long long c1 = p[ind].second + solve(ind + 1, ind);
  long long c2 = (p[ind].first - p[pos].first) + solve(ind + 1, pos);
  long long m = min(c1, c2);
  dp[ind][pos] = m;
  return m;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long a, b;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    p.push_back(make_pair(a, b));
  }
  for (long long i = 0; i < n + 1; i++)
    for (long long j = 0; j < n + 1; j++) dp[i][j] = -1;
  sort(p.begin(), p.end());
  cout << p[0].second + solve(1, 0) << "\n";
  return 0;
}
