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