#include <bits/stdc++.h>
using namespace std;
const int mx1 = 15;
const int mx2 = 105;
const int mx3 = 3005;
const int mx4 = 30005;
const int mx5 = 300005;
const int mx6 = 400005;
int _toggle(int N, int pos) { return N = N ^ (1 << pos); }
int _set(int N, int pos) { return N = N | (1 << pos); }
int _reset(int N, int pos) { return N = N & ~(1 << pos); }
bool _check(int N, int pos) { return (bool)(N & (1 << pos)); }
bool _upper(char a) { return a >= 'A' && a <= 'Z'; }
bool _lower(char a) { return a >= 'a' && a <= 'z'; }
bool _digit(char a) { return a >= '0' && a <= '9'; }
int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, 1, -1, -1, 1, -1, 1};
long long dp[mx3][mx3];
int n;
pair<int, int> a[mx3];
long long call(int now, int last) {
  if (now == n) {
    return 0;
  }
  if (dp[now][last] != -1) {
    return dp[now][last];
  }
  long long r1 = a[now].second + call(now + 1, now);
  long long r2 = a[now].first - a[last].first + call(now + 1, last);
  return dp[now][last] = min(r1, r2);
}
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + n);
  memset(dp, -1, sizeof(dp));
  cout << a[0].second + call(1, 0) << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tc = 1;
  while (tc--) {
    solve();
  }
}
