#include <bits/stdc++.h>
using namespace std;
bool comp(vector<long long>& a, vector<long long>& b) { return a[0] < b[0]; }
long long n;
vector<vector<long long> > v(3005, vector<long long>(2));
long long dp[3005][3005];
long long dfs(long long i, long long last) {
  if (i > n) return 0;
  if (dp[i][last] != LLONG_MAX) return dp[i][last];
  dp[i][last] =
      min(v[i][0] - v[last][0] + dfs(i + 1, last), v[i][1] + dfs(i + 1, i));
  return dp[i][last];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) dp[i][j] = LLONG_MAX;
  for (int i = 1; i <= n; i++) cin >> v[i][0] >> v[i][1];
  sort(v.begin() + 1, v.begin() + n + 1, comp);
  cout << v[1][1] + dfs(2, 1);
  return 0;
}
