#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 3e3 + 4;
long long dp[N];
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int>> v(n);
  for (int i = 0; i < n; i++)
    scanf("%d", &v[i].first), scanf("%d", &v[i].second);
  sort(v.begin(), v.end());
  dp[n - 1] = v[n - 1].second;
  for (int i = n - 2; i >= 0; i--) {
    dp[i] = v[i].second + dp[i + 1];
    long long sum = 0;
    for (int j = i; j < n; j++) {
      sum += (v[j].first - v[i].first);
      dp[i] = min(dp[i], sum + dp[j + 1] + v[i].second);
    }
  }
  cout << dp[0];
  return 0;
}
