#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000;
pair<int, int> m[MAXN];
long long dp[MAXN][MAXN];
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i != n; ++i) {
    scanf("%d%d", &(m[i].first), &(m[i].second));
  }
  sort(m, m + n);
  memset(dp, 0x7f, sizeof(dp));
  dp[0][0] = m[0].second;
  for (int i = 1; i != n; ++i) {
    for (int j = 0; j != i; ++j) {
      dp[i][i] = min(dp[i][i], dp[i - 1][j] + m[i].second);
      dp[i][j] = dp[i - 1][j] + m[i].first - m[j].first;
    }
  }
  long long r = 3000000000000LL;
  for (int i = 0; i != n; ++i) {
    r = min(r, dp[n - 1][i]);
  }
  cout << r << endl;
  return 0;
}
