#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAXN = 3003;
pair<int, int> a[MAXN];
long long dp[MAXN], sx[MAXN], x[MAXN], c[MAXN];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + n);
  for (int i = 1; i <= n; ++i) {
    x[i] = a[i - 1].first;
    c[i] = a[i - 1].second;
    sx[i] = sx[i - 1] + x[i];
  }
  for (int i = 1; i <= n; ++i) {
    dp[i] = INF;
    for (int j = 1; j <= i; ++j) {
      long long rollingCost = sx[i] - sx[j - 1] - (i - j + 1) * x[j];
      dp[i] = min(dp[i], c[j] + dp[j - 1] + rollingCost);
    }
  }
  cout << dp[n];
}
