#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[3010];
long long dp[3010][3010];
int n;
long long func(long long here, long long be) {
  if (here == n) return 0;
  long long &ret = dp[here][be];
  if (ret != -1) return ret;
  ret = 999999999999999;
  ret = min(ret, func(here + 1, here) + a[here].second);
  ret = min(ret, func(here + 1, be) + a[here].first - a[be].first);
  return ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld %lld", &a[i].first, &a[i].second);
  sort(a, a + n);
  long long dap = func(1, 0) + a[0].second;
  printf("%lld", dap);
}
