#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000 + 10;
pair<long long, long long> m[MAXN];
long long dp[MAXN];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> m[i].first >> m[i].second;
  dp[n] = 0;
  sort(m, m + n);
  for (int i = n - 1; i >= 0; i--) {
    long long sum = 0;
    dp[i] = 1LL << 62;
    for (int j = i; j < n; j++) {
      sum += m[j].first - m[i].first;
      dp[i] = min(dp[i], dp[j + 1] + sum + m[i].second);
    }
  }
  cout << dp[0] << endl;
  return 0;
}
