#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int neginf = 0xC0C0C0C0;
using namespace std;
const int N = 3007;
pair<int, int> a[N];
long long dp[N];
long long sum[N];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i < (n + 1); ++i) scanf("%d%d", &a[i].first, &a[i].second);
    sort(a + 1, a + n + 1);
    memset(dp, 0x3f, sizeof(dp));
    dp[0] = 0;
    sum[0] = 0;
    for (int i = 1; i < (n + 1); ++i) {
      sum[i] = a[i].first;
      if (i) sum[i] += sum[i - 1];
    }
    for (int i = 1; i < (n + 1); ++i) {
      dp[i] = a[i].second + dp[i - 1];
      for (int j = 1; j < (i); ++j) {
        dp[i] = min(dp[i], dp[j - 1] + a[j].second + sum[i] - sum[j] -
                               (long long)a[j].first * (i - j));
      }
    }
    printf("%I64d\n", dp[n]);
  }
  return 0;
}
