#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
vector<pair<long long, long long> > balls;
long long dp[3002][3002];
long long solve(int pos, int stopper) {
  if (pos == balls.size()) return 0LL;
  if (dp[pos][stopper] > 0LL) return dp[pos][stopper];
  long long& res = dp[pos][stopper];
  res = ((long long)((1LL << 52) - 1));
  res = min(res,
            balls[pos].first - balls[stopper].first + solve(pos + 1, stopper));
  res = min(res, balls[pos].second + solve(pos + 1, pos));
  return res;
}
int main() {
  for (int i = 0; i < 3002; ++i)
    for (int j = 0; j < 3002; ++j) dp[i][j] = -1LL;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    long long A, B;
    A = a;
    B = b;
    balls.push_back(make_pair(A, B));
  }
  ::sort((balls).begin(), (balls).end());
  long long res = balls[0].second;
  for (int pos = n; pos >= 0; --pos)
    for (int stopper = pos; stopper >= 0; --stopper) {
      if (pos == balls.size()) {
        dp[pos][stopper] = 0LL;
        continue;
      }
      long long& res = dp[pos][stopper];
      res = ((long long)((1LL << 52) - 1));
      res = min(res,
                balls[pos].first - balls[stopper].first + dp[pos + 1][stopper]);
      res = min(res, balls[pos].second + dp[pos + 1][pos]);
    }
  cout << res + dp[1][0];
  return 0;
}
