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;
inline void readi(int &x);
inline void readll(long long &x);
const int maxn = 100005, N = 1000000;
int n, tot, p[maxn];
int ps[N + 1], minf[N + 1];
int pr[N / 5], pn;
long long a[maxn], ans[N / 5], k;
struct seg {
  long long x, y;
  seg() {}
  seg(const long long &_x, const long long &_y) {
    x = _x;
    y = _y;
  }
  bool operator<(const seg &o) const { return x == o.x ? y < o.y : x < o.x; }
} st[N];
vector<seg> v[N / 5];
int top;
void init() {
  readi(n);
  for (int i = 2; i <= N; i++) {
    if (!minf[i]) pr[ps[i] = ++pn] = i, minf[i] = i;
    for (int j = 1; j <= pn && pr[j] * i <= N; j++) {
      minf[pr[j] * i] = pr[j];
      if (i % pr[j] == 0) break;
    }
  }
  for (int i = 1; i <= n; i++) {
    readi(p[i]), readll(a[i]);
    v[ps[p[i]]].push_back(seg(0, a[i]));
  }
  readll(k);
}
void maintain(vector<seg> &v) {
  sort(v.begin(), v.end());
  seg s;
  top = 0;
  for (vector<seg>::iterator it = v.begin(); it != v.end(); it++) {
    s = *it;
    while (top && st[top].y >= s.x) {
      s.y += st[top].y - s.x;
      s.x = st[top].x;
      top--;
    }
    st[++top] = s;
  }
  v.clear();
  for (int i = 1; i <= top; i++)
    if (st[i].x < k && st[i].y > k) {
      v.push_back(seg(st[i].x, k));
      v.push_back(seg(k, st[i].y));
    } else
      v.push_back(st[i]);
}
void work() {
  vector<seg>::iterator it;
  for (int i = pn, c, t; c = pr[i], i > 0; i--)
    if (!v[i].empty()) {
      maintain(v[i]);
      for (it = v[i].begin(); it != v[i].end(); it++)
        if (it->y <= k) {
          for (t = c - 1; t > 1; t /= minf[t])
            v[ps[minf[t]]].push_back(seg(it->x + 1, it->y + 1));
        } else
          tot += (ans[i] == 0), ans[i] += it->y - it->x;
    }
  printf("%d\n", tot);
  for (int i = 1; i <= pn; i++)
    if (ans[i]) printf("%d %I64d\n", pr[i], ans[i]);
}
int main() {
  init();
  work();
  return 0;
}
inline void readi(int &x) {
  char c;
  for (c = getchar(); c > '9' || c < '0'; c = getchar())
    ;
  x = c ^ '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar())
    x = x * 10 + (c ^ '0');
}
inline void readll(long long &x) {
  char c;
  for (c = getchar(); c > '9' || c < '0'; c = getchar())
    ;
  x = c ^ '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar())
    x = x * 10 + (c ^ '0');
}