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 mod = 1000000007;
const unsigned gen_seed =
    std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937_64 gen(gen_seed);
long long curd[80000];
long long last[80000];
long long dd[80000];
const int LIMIT = 1000000;
std::vector<bool> isp(LIMIT + 1, true);
std::vector<int> mindiv(LIMIT + 1, 0);
std::vector<int> p;
std::vector<std::pair<int, int> > pinc[80000];
int cnt;
long long k;
long long cur;
set<std::pair<long long, long long> > lft;
long long dest[80000];
void recount() {
  for (int i = 0; i < cnt; i++) {
    dd[i] = 0;
    if (curd[i] > 0) {
      dd[i]--;
      for (auto x : pinc[i]) dd[x.first] += x.second;
    }
  }
}
void reb() {
  for (int i = 0; i < cnt; i++) {
    if (curd[i] == 0) continue;
    if (dd[i] < 0)
      dest[i] = cur - curd[i];
    else
      dest[i] = 0;
    lft.insert(make_pair(-dest[i], i));
  }
}
void bump(int i) {
  curd[i] += dd[i] * (last[i] - cur);
  last[i] = cur;
}
void upd(int i) {
  lft.erase(make_pair(-dest[i], i));
  if (dd[i] >= 0)
    dest[i] = 0;
  else
    dest[i] = cur - curd[i];
  if (curd[i] > 0) lft.insert(make_pair(-dest[i], i));
}
void rem(int i) {
  bump(i);
  dd[i]++;
  upd(i);
  for (auto x : pinc[i]) {
    bump(x.first);
    dd[x.first] -= x.second;
    upd(x.first);
  }
}
int main() {
  for (int i = 0; i < LIMIT + 1; i++) mindiv[i] = i;
  int upbound = (int)sqrt((double)LIMIT);
  for (int m = 2; m <= upbound; m++) {
    if (isp[m]) {
      p.push_back(m);
      for (int k = m * m; k <= LIMIT; k += m) {
        isp[k] = false;
        mindiv[k] = min(mindiv[k], m);
      }
    }
  }
  for (int m = upbound + 1; m <= LIMIT; m++) {
    if (isp[m]) {
      p.push_back(m);
    }
  }
  std::vector<int> pnum(1000000);
  for (int i = 0; i < p.size(); i++) pnum[p[i]] = i;
  cnt = p.size();
  for (int i = 0; i < cnt; i++) {
    int x = p[i] - 1;
    std::vector<int> lol;
    while (x > 1) {
      lol.push_back(pnum[mindiv[x]]);
      x /= mindiv[x];
    }
    int pt = 0;
    while (pt < lol.size()) {
      int pr = pt + 1;
      while (pr < lol.size() && lol[pr] == lol[pt]) pr++;
      pinc[i].push_back(make_pair(lol[pt], pr - pt));
      pt = pr;
    }
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int p;
    long long d;
    scanf("%d %lld", &p, &d);
    curd[pnum[p]] += d;
  }
  scanf("%lld", &k);
  for (int i = 0; i < 20; i++) {
    if (k == 0) break;
    recount();
    for (int i = 0; i < cnt; i++) curd[i] += dd[i];
    k--;
  }
  cur = k;
  for (int i = 0; i < cnt; i++) last[i] = cur;
  recount();
  reb();
  lft.insert(make_pair(1, -1));
  while (1) {
    if (cur == 0) break;
    auto x = *lft.begin();
    long long nt = -x.first;
    if (nt <= 0) break;
    cur = nt;
    rem(x.second);
  }
  std::vector<std::pair<long long, long long> > ans;
  cur = 0;
  for (int i = 0; i < cnt; i++) {
    bump(i);
    if (curd[i] > 0) ans.push_back(make_pair(p[i], curd[i]));
  }
  printf("%d\n", ans.size());
  for (auto x : ans) printf("%lld %lld\n", x.first, x.second);
}