#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > occ[1000001], divisors[1000001], res_vek;
long long k;
void sieve() {
  for (int ctr1 = 2; ctr1 < 1000001; ++ctr1) {
    if (divisors[ctr1].empty()) {
      for (long long ctr2 = ctr1; ctr2 < 1000001; ctr2 = ctr2 * ctr1)
        for (int ctr3 = ctr2; ctr3 < 1000001; ctr3 += ctr2) {
          if (divisors[ctr3].empty() || divisors[ctr3].back().first != ctr1)
            divisors[ctr3].push_back({ctr1, 0});
          divisors[ctr3].back().second++;
        }
    }
  }
}
long long update(int cur, pair<long long, long long> range) {
  long long rez = 0;
  if (divisors[cur].size() == 1 && divisors[cur].back().second == 1) {
    if (range.second > k) {
      rez = range.second - max(k, range.first);
      range.second -= rez;
    }
    range.first++;
    range.second++;
    if (range.first < range.second) occ[cur - 1].push_back({range});
  } else {
    for (const auto& it : divisors[cur]) {
      occ[it.first].push_back(
          {range.first,
           range.first + (range.second - range.first) * it.second});
    }
  }
  return rez;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  sieve();
  int m;
  cin >> m;
  for (int ctr1 = 0; ctr1 < m; ++ctr1) {
    long long p, a;
    cin >> p >> a;
    occ[p].push_back({0LL, a});
  }
  cin >> k;
  for (int ctr1 = 1000001 - 1; ctr1 > 1; --ctr1) {
    if (occ[ctr1].empty()) continue;
    sort(occ[ctr1].begin(), occ[ctr1].end());
    auto cur = occ[ctr1].front();
    long long tot = 0;
    for (uint32_t ctr2 = 1; ctr2 < occ[ctr1].size(); ++ctr2) {
      if (cur.second >= occ[ctr1][ctr2].first) {
        cur.second += occ[ctr1][ctr2].second - occ[ctr1][ctr2].first;
      } else {
        tot += update(ctr1, cur);
        cur = occ[ctr1][ctr2];
      }
    }
    tot += update(ctr1, cur);
    if (tot) res_vek.push_back({ctr1, tot});
  }
  reverse(res_vek.begin(), res_vek.end());
  cout << res_vek.size() << '\n';
  for (const auto& it : res_vek) cout << it.first << ' ' << it.second << '\n';
  return 0;
}

### Prompt

Create a solution in cpp for the following 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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > occ[1000001], divisors[1000001], res_vek;
long long k;
void sieve() {
  for (int ctr1 = 2; ctr1 < 1000001; ++ctr1) {
    if (divisors[ctr1].empty()) {
      for (long long ctr2 = ctr1; ctr2 < 1000001; ctr2 = ctr2 * ctr1)
        for (int ctr3 = ctr2; ctr3 < 1000001; ctr3 += ctr2) {
          if (divisors[ctr3].empty() || divisors[ctr3].back().first != ctr1)
            divisors[ctr3].push_back({ctr1, 0});
          divisors[ctr3].back().second++;
        }
    }
  }
}
long long update(int cur, pair<long long, long long> range) {
  long long rez = 0;
  if (divisors[cur].size() == 1 && divisors[cur].back().second == 1) {
    if (range.second > k) {
      rez = range.second - max(k, range.first);
      range.second -= rez;
    }
    range.first++;
    range.second++;
    if (range.first < range.second) occ[cur - 1].push_back({range});
  } else {
    for (const auto& it : divisors[cur]) {
      occ[it.first].push_back(
          {range.first,
           range.first + (range.second - range.first) * it.second});
    }
  }
  return rez;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  sieve();
  int m;
  cin >> m;
  for (int ctr1 = 0; ctr1 < m; ++ctr1) {
    long long p, a;
    cin >> p >> a;
    occ[p].push_back({0LL, a});
  }
  cin >> k;
  for (int ctr1 = 1000001 - 1; ctr1 > 1; --ctr1) {
    if (occ[ctr1].empty()) continue;
    sort(occ[ctr1].begin(), occ[ctr1].end());
    auto cur = occ[ctr1].front();
    long long tot = 0;
    for (uint32_t ctr2 = 1; ctr2 < occ[ctr1].size(); ++ctr2) {
      if (cur.second >= occ[ctr1][ctr2].first) {
        cur.second += occ[ctr1][ctr2].second - occ[ctr1][ctr2].first;
      } else {
        tot += update(ctr1, cur);
        cur = occ[ctr1][ctr2];
      }
    }
    tot += update(ctr1, cur);
    if (tot) res_vek.push_back({ctr1, tot});
  }
  reverse(res_vek.begin(), res_vek.end());
  cout << res_vek.size() << '\n';
  for (const auto& it : res_vek) cout << it.first << ' ' << it.second << '\n';
  return 0;
}

```