/**
 *    author:  tourist
 *    created: 17.11.2019 02:03:54       
**/
#include <bits/stdc++.h>

using namespace std;

class dsu {
 public:
  vector<int> p;
  int n;

  dsu(int _n) : n(_n) {
    p.resize(n);
    iota(p.begin(), p.end(), 0);
  }

  inline int get(int x) {
    return (x == p[x] ? x : (p[x] = get(p[x])));
  }

  inline bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x != y) {
      p[x] = y;
      return true;
    }
    return false;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  vector<tuple<int, int, int>> e;
  auto Add = [&](int i, int j) { e.emplace_back(min(abs(x[i] - x[j]), abs(y[i] - y[j])), i, j); };
  {
    vector<int> order(n);
    iota(order.begin(), order.end(), 0);
    sort(order.begin(), order.end(), [&](int i, int j) { return x[i] < x[j]; });
    for (int i = 0; i < n - 1; i++) Add(order[i], order[i + 1]);
  }
  {
    vector<int> order(n);
    iota(order.begin(), order.end(), 0);
    sort(order.begin(), order.end(), [&](int i, int j) { return y[i] < y[j]; });
    for (int i = 0; i < n - 1; i++) Add(order[i], order[i + 1]);
  }
  sort(e.begin(), e.end());
  dsu d(n);
  long long ans = 0;
  for (auto& ee : e) {
    if (d.unite(get<1>(ee), get<2>(ee))) ans += get<0>(ee);
  }
  cout << ans << '\n';
  return 0;
}

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
// #define INF __INT32_MAX__
#define INF 1e9
#define LINF __LONG_LONG_MAX__

int main() {
    int D, G; cin >> D >> G;
    vi P(D), C(D); rep(i, D) cin >> P[i] >> C[i];

    int res = INF;
    for (int i = 0; i < 1<<D; i++) {
        vi tmp;
        vi notselected;
        for (int j = 0; j < D; j++) {
            if (i & 1<<j) {
                tmp.push_back(j);
            } else {
                notselected.push_back(j);
            }
        }

        int sum = 0;
        int cnt = 0;
        for (auto ii : tmp) {
            int x = 100 * (ii + 1) * P[ii] + C[ii];
            sum += x;
            cnt += P[ii];
        }
        if (sum >= G) {
            res = min(res, cnt);
            continue;
        }

        sort(notselected.begin(), notselected.end());
        reverse(notselected.begin(), notselected.end());
        int diff = G - sum;
        for (auto ii : notselected) {
            if (diff <= 0) break;
            int x = 100 * (ii + 1) * P[ii] + C[ii];
            if (diff - x > 0) {
                diff -= x;
                cnt += P[ii];
                continue;
            }

            for (int jj = 0; jj < P[ii]; jj++) {
                diff -= 100 * (ii + 1);
                cnt++;
                if (jj == P[ii] - 1) diff -= C[ii];
                if (diff <= 0) break;
            }
        }
        res = min(res, cnt);
    }

    cout << res << endl;
}
