#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long LIM = 1000010;
const long long mod = (1e9 + 7);
int main() {
  cin.sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  std::vector<std::pair<long long, long long> > xc(n);
  for (long long i = 0; i < n; i++) cin >> xc[i].first >> xc[i].second;
  sort((xc).begin(), (xc).end());
  std::vector<std::vector<long long> > dp(n, std::vector<long long>(n, 0));
  std::vector<long long> ans(n, 0);
  dp[0][0] = ans[0] = xc[0].second;
  for (long long i = 1; i < n; i++) {
    dp[i][i] = ans[i - 1] + xc[i].second;
    ans[i] = dp[i][i];
    for (long long fixed = 0; fixed < i; fixed++) {
      dp[i][fixed] = dp[i - 1][fixed] + (xc[i].first - xc[fixed].first);
      ans[i] = min(ans[i], dp[i][fixed]);
    }
  }
  cout << ans[n - 1] << endl;
}
