#include <bits/stdc++.h>
using namespace std;
int main() {
  cout << fixed;
  cout.precision(9);
  int n;
  cin >> n;
  vector<pair<long long, long long> > ball(n);
  for (int i = 0; i < n; i++) {
    cin >> ball[i].first >> ball[i].second;
  }
  sort(ball.begin(), ball.end());
  vector<long long> dp(n);
  dp[0] = ball[0].second;
  for (int k = 1; k < n; k++) {
    long long r = ball[k].second + dp[k - 1];
    long long s = 0;
    for (int i = k - 1; i >= 0; --i) {
      s += (k - i) * (ball[i + 1].first - ball[i].first);
      long long ch = ball[i].second + s;
      if (i > 0) ch += dp[i - 1];
      r = min(r, ch);
    }
    dp[k] = r;
  }
  cout << dp[n - 1] << endl;
  return 0;
}
