#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const int N = 3010;
struct POINT {
  long long x;
  long long c;
  bool operator<(const POINT &e) const { return x < e.x; }
} p[N];
int n, k, m;
long long dp[N];
long long min(long long x, long long y) { return x < y ? x : y; }
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i].x >> p[i].c;
  if (n == 1) {
    cout << p[1].c;
    return 0;
  }
  sort(p + 1, p + 1 + n);
  dp[n] = p[n].c;
  for (int i = n - 1; i >= 1; i--) {
    dp[i] = dp[i + 1] + p[i].c;
    long long pre = 0;
    for (int j = i; j <= n; j++) pre += p[j].x - p[i].x;
    dp[i] = min(dp[i], pre + p[i].c);
    pre = 0;
    for (int j = i + 1; j <= n - 1; j++) {
      pre += p[j].x - p[i].x;
      dp[i] = min(dp[i], dp[j + 1] + pre + p[i].c);
    }
  }
  cout << dp[1];
  return 0;
}
