#include <bits/stdc++.h>
using namespace std;
const int maxn = 3333;
struct node {
  long long x, cost;
  friend bool operator<(node a, node b) { return a.x < b.x; }
} a[3333];
long long cost[maxn][maxn];
long long dp[maxn];
int main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld%lld", &a[i].x, &a[i].cost);
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      cost[j][i] = a[j].x - a[i].x;
    }
    for (int j = i + 1; j <= n; j++) {
      cost[j][i] += cost[j - 1][i];
    }
  }
  dp[1] = a[1].cost;
  for (int i = 2; i <= n; i++) {
    dp[i] = 13278126378612783;
    for (int j = 1; j < i; j++) {
      dp[i] = min(dp[i], dp[j] + cost[i - 1][j] + a[i].cost);
    }
  }
  long long Min = 13278126378612783;
  for (int i = 1; i <= n; i++) {
    Min = min(dp[i] + cost[n][i], Min);
  }
  printf("%lld\n", Min);
  return 0;
}
