#include <bits/stdc++.h>
using namespace std;
long long dp[3005][3], update[3005], val[3005][3005];
long long mod = 100000000000000;
vector<pair<long long, long long> > solve;
int main() {
  int n;
  long long x, c;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> c;
    solve.push_back(make_pair(x, c));
  }
  sort(solve.begin(), solve.end());
  dp[0][0] = solve[0].second;
  dp[0][1] = 2e18;
  dp[0][2] = solve[0].second;
  for (int i = 0; i < solve.size() - 1; i++) {
    for (int j = i + 1; j < solve.size(); j++) {
      val[i][j] = val[i][j - 1] + solve[j].first - solve[i].first;
    }
  }
  for (int i = 1; i < solve.size(); i++) {
    dp[i][1] = mod;
    for (int j = i - 1; j >= 0; j--) {
      dp[i][1] = min(dp[i][1], dp[j][0] + val[j][i]);
    }
    dp[i][0] = dp[i - 1][2] + solve[i].second;
    dp[i][2] = min(dp[i][1], dp[i][0]);
  }
  cout << dp[solve.size() - 1][2] << endl;
}
