#include <bits/stdc++.h>
using namespace std;
int x, y;
vector<pair<int, long long> > v;
long long dp[3001][3001];
long long solve(int i, int j) {
  if (i == x) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  long long c1 = solve(i + 1, j) + v[i].first - v[j].first;
  long long c2 = solve(i + 1, i) + v[i].second;
  dp[i][j] = min(c1, c2);
  return dp[i][j];
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> x;
  int i;
  long long a, b;
  for ((i) = 0; (i) < (int)(x); (i)++) {
    cin >> a >> b;
    v.push_back({a, b});
  }
  sort(v.begin(), v.end());
  long long res = solve(1, 0) + v[0].second;
  cout << res;
}
