#include <bits/stdc++.h>
using namespace std;
const long long N = 3005;
struct Data {
  long long x, c;
  bool operator<(const Data &other) const { return x < other.x; }
} a[N];
long long dp[N][2], dist[N][N], pref[N][N];
signed main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld %lld", &a[i].x, &a[i].c);
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++) {
    for (long long j = i; j <= n; j++) {
      dist[i][j] = a[j].x - a[i].x;
      if (j == i)
        pref[i][j] = dist[i][j];
      else
        pref[i][j] = pref[i][j - 1] + dist[i][j];
    }
  }
  memset(dp, 0x3f, sizeof(dp));
  dp[1][1] = a[1].c;
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j < 2; j++) {
      if (j == 1)
        dp[i][j] = min(dp[i][j], min(dp[i - 1][0], dp[i - 1][1]) + a[i].c);
      else {
        for (long long k = 1; k < i; k++) {
          if (dp[k][1] < 1e18) {
            dp[i][j] = min(dp[i][j], dp[k][1] + pref[k][i]);
          }
        }
      }
    }
  }
  printf("%lld", min(dp[n][0], dp[n][1]));
  return 0;
}
