#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x;
  long long c;
} a[3005];
long long dp[3005][3005];
bool cmp(node a, node b) { return a.x < b.x; }
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].x >> a[i].c;
  sort(a + 1, a + n + 1, cmp);
  dp[1][1] = a[1].c;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= i - 1; j++) {
      dp[i][j] = dp[i - 1][j] + a[i].x - a[j].x;
    }
    long long res = dp[i - 1][i - 1] + a[i].c;
    for (int j = 1; j <= i - 1; j++) {
      if (res > dp[i - 1][j] + a[i].c) res = dp[i - 1][j] + a[i].c;
    }
    dp[i][i] = res;
  }
  long long ans = dp[n][1];
  for (int i = 1; i <= n; i++) {
    if (dp[n][i] < ans) ans = dp[n][i];
  }
  cout << ans;
  return 0;
}
