#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
int n;
vector<pair<int, int> > v;
long long DP[3001][3001];
long long solve(int idx, int lst) {
  if (idx == n) return 0;
  long long &ret = DP[idx][lst];
  if (ret != -1) return ret;
  ret = (1LL << 59);
  ret = min(ret, solve(idx + 1, lst) + v[idx].first - v[lst].first);
  ret = min(ret, solve(idx + 1, idx) + v[idx].second);
  return ret;
}
int main() {
  scanf("%d", &n);
  int a, b;
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &a, &b);
    v.push_back(pair<int, int>(a, b));
  }
  memset(DP, -1, sizeof(DP));
  sort(v.begin(), v.end());
  cout << solve(1, 0) + 1LL * v[0].second;
}
