Problem: Of course, many of you can calculate φ(n) — the number of positive integers that are less than or equal to n, that are coprime with n. But what if we need to calculate φ(φ(...φ(n))), where function φ is taken k times and n is given in the canonical decomposition into prime factors? 

You are given n and k, calculate the value of φ(φ(...φ(n))). Print the result in the canonical decomposition into prime factors.

Input

The first line contains integer m (1 ≤ m ≤ 105) — the number of distinct prime divisors in the canonical representaion of n.

Each of the next m lines contains a pair of space-separated integers pi, ai (2 ≤ pi ≤ 106; 1 ≤ ai ≤ 1017) — another prime divisor of number n and its power in the canonical representation. The sum of all ai doesn't exceed 1017. Prime divisors in the input follow in the strictly increasing order.

The last line contains integer k (1 ≤ k ≤ 1018).

Output

In the first line, print integer w — the number of distinct prime divisors of number φ(φ(...φ(n))), where function φ is taken k times.

Each of the next w lines must contain two space-separated integers qi, bi (bi ≥ 1) — another prime divisor and its power in the canonical representaion of the result. Numbers qi must go in the strictly increasing order.

Examples

Input

1
7 1
1


Output

2
2 1
3 1


Input

1
7 1
2


Output

1
2 1


Input

1
2 100000000000000000
10000000000000000


Output

1
2 90000000000000000

Note

You can read about canonical representation of a positive integer here: http://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic.

You can read about function φ(n) here: http://en.wikipedia.org/wiki/Euler's_totient_function.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 1e6 + 500;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
vector<pair<long long, long long> > baze[maxn];
vector<pair<long long, long long> > khor[maxn];
vector<long long> amel[maxn];
bool pr[maxn];
long long yeki[maxn];
long long ans[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 2; i < maxn; i++) {
    if (pr[i] == 0) {
      for (long long j = i; j < maxn; j += i) {
        pr[j] = 1;
        yeki[j] = i;
      }
      pr[i] = 0;
    }
  }
  for (long long j = 2; j < maxn; j++) {
    long long v = j;
    while (v > 1) {
      amel[j].push_back(yeki[v]);
      v /= yeki[v];
    }
  }
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long p, a;
    cin >> p >> a;
    baze[p].push_back(make_pair(1, a));
  }
  long long k;
  cin >> k;
  for (long long i = maxn - 1; i >= 2; i--) {
    if (baze[i].size() > 0) {
      sort(baze[i].begin(), baze[i].end());
      long long etmam = baze[i][0].second + 1;
      long long fir = baze[i][0].first;
      for (long long j = 1; j < baze[i].size(); j++) {
        if (baze[i][j].first > etmam) {
          khor[i].push_back(make_pair(fir, etmam - 1));
          fir = baze[i][j].first;
          etmam = baze[i][j].second + 1;
        } else {
          etmam += baze[i][j].second - baze[i][j].first + 1;
        }
      }
      khor[i].push_back(make_pair(fir, etmam - 1));
      for (long long j = 0; j < khor[i].size(); j++) {
        if (khor[i][j].first > k) {
          khor[i][j] = make_pair(0, -1);
        } else {
          khor[i][j].second = min(khor[i][j].second, k);
        }
      }
      long long v = 0;
      for (long long j = 0; j < baze[i].size(); j++) {
        v += baze[i][j].second - baze[i][j].first + 1;
      }
      for (long long j = 0; j < khor[i].size(); j++) {
        v -= khor[i][j].second - khor[i][j].first + 1;
      }
      ans[i] = v;
      if (i != 2) {
        for (long long j = 0; j < khor[i].size(); j++) {
          if (khor[i][j] == make_pair(0LL, -1LL)) {
            continue;
          }
          for (long long k = 0; k < amel[i - 1].size(); k++) {
            long long v = amel[i - 1][k];
            baze[v].push_back(
                make_pair(khor[i][j].first + 1, khor[i][j].second + 1));
          }
        }
      }
    }
  }
  long long tt = 0;
  for (long long i = 2; i < maxn; i++) {
    if (ans[i]) {
      tt++;
    }
  }
  cout << tt << endl;
  for (long long i = 2; i < maxn; i++) {
    if (ans[i]) {
      cout << i << ' ' << ans[i] << endl;
    }
  }
}