#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int maxn = 3010;
const int mod = 1000000007;
struct node {
  int x, c;
  bool operator<(const node& s) const { return x < s.x; }
} p[maxn];
long long dp[maxn][maxn];
long long ans;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i].x >> p[i].c;
  }
  sort(p, p + n);
  dp[0][0] = p[0].c;
  ans = p[0].c;
  for (int i = 1; i < n; i++) {
    long long mine = inf;
    for (int j = 0; j < i; j++) {
      dp[i][j] = dp[i - 1][j] + p[i].x - p[j].x;
    }
    dp[i][i] = ans + p[i].c;
    ans = dp[i][0];
    for (int j = 1; j <= i; j++) {
      ans = min(ans, dp[i][j]);
    }
  }
  cout << ans << "\n";
  return 0;
}
