#include <bits/stdc++.h>
using namespace std;
long long n;
pair<long long, long long> xc[3005];
long long vis[3005][3005], memo[3005][3005];
long long dp(long long curr, long long prev) {
  if (curr == n - 1)
    return min(xc[n - 1].second, xc[n - 1].first - xc[prev].first);
  long long &ans = memo[curr][prev];
  if (vis[curr][prev]) return ans;
  vis[curr][prev] = 1;
  ans = min(dp(curr + 1, curr) + xc[curr].second,
            dp(curr + 1, prev) + xc[curr].first - xc[prev].first);
  return ans;
}
int main() {
  memset(vis, 0, sizeof vis);
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) {
    scanf("%lld %lld", &xc[i].first, &xc[i].second);
  }
  if (n > 1) {
    sort(xc, xc + n);
    long long ans = dp(1, 0);
    printf("%lld", ans + xc[0].second);
  } else {
    printf("%lld", xc[0].second);
  }
}
