#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, x, y, c, i, j, k, ans, ct, INF = 1LL << 60, s;
  cin >> n;
  vector<pair<long long, long long>> v(n);
  for (i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end());
  vector<long long> dp(n + 1, INF);
  dp[n] = 0;
  for (i = n - 1; i >= 0; i--) {
    s = v[i].second;
    for (j = i + 1; j <= n; j++) {
      dp[i] = min(dp[i], s + dp[j]);
      if (j < n) s += (v[j].first - v[i].first);
    }
  }
  ans = dp[0];
  cout << ans << "\n";
  return 0;
}
