#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int p, s, t;
int bpow(int x, int k) {
  if (k == 1) return x;
  if (k & 1) return x * 1ll * bpow(x, k - 1) % p;
  int tmp = bpow(x, k / 2);
  return tmp * 1ll * tmp % p;
}
int rev(int x) { return bpow(x, p - 2); }
int dist(int x, int y) { return min((x - y + p) % p, (y - x + p) % p); }
map<int, int> was[2];
int m[2];
int getMinDist() {
  auto l = was[0].begin();
  auto r = was[1].begin();
  m[0] = l->first;
  m[1] = r->first;
  int ret = dist(l->first, r->first);
  while (l != was[0].end() && r != was[1].end()) {
    if (ret > dist(l->first, r->first)) {
      ret = dist(l->first, r->first);
      m[0] = l->first;
      m[1] = r->first;
    }
    if (l->first < r->first)
      l++;
    else
      r++;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> t >> p;
  was[0][s] = -1;
  was[1][t] = -1;
  int itr = 0;
  while (true) {
    int d = getMinDist();
    ;
    if (d < 100) break;
    auto& cur = was[itr & 1];
    map<int, int> add;
    for (const auto& kv : cur) {
      int v = kv.first;
      vector<int> g = {(v + 1) % p, (v + p - 1) % p, rev(v)};
      for (int u : g) {
        if (cur.count(u) == 0) add[u] = v;
      }
    }
    for (const auto& kv : add) cur[kv.first] = kv.second;
    itr++;
  }
  vector<int> ans;
  int y, x = m[0];
  while ((y = was[0][x]) != -1) {
    if ((y + 1) % p == x)
      ans.push_back(1);
    else if ((y - 1 + p) % p == x)
      ans.push_back(2);
    else
      ans.push_back(3);
    x = y;
  }
  reverse(ans.begin(), ans.end());
  x = m[0], y = m[1];
  if ((y - x + p) % p < (x - y + p) % p) {
    while (x != y) {
      ans.push_back(1);
      x = (x + 1) % p;
    }
  } else {
    while (x != y) {
      ans.push_back(2);
      x = (x - 1 + p) % p;
    }
  }
  x = m[1];
  while ((y = was[1][x]) != -1) {
    if ((x + 1) % p == y)
      ans.push_back(1);
    else if ((x - 1 + p) % p == y)
      ans.push_back(2);
    else
      ans.push_back(3);
    x = y;
  }
  cout << ans.size() << endl;
  for (int x : ans) cout << x << " ";
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

Allen is playing Number Clicker on his phone.

He starts with an integer u on the screen. Every second, he can press one of 3 buttons.

  1. Turn u → u+1 \pmod{p}. 
  2. Turn u → u+p-1 \pmod{p}. 
  3. Turn u → u^{p-2} \pmod{p}. 



Allen wants to press at most 200 buttons and end up with v on the screen. Help him!

Input

The first line of the input contains 3 positive integers: u, v, p (0 ≤ u, v ≤ p-1, 3 ≤ p ≤ 10^9 + 9). p is guaranteed to be prime.

Output

On the first line, print a single integer ℓ, the number of button presses. On the second line, print integers c_1, ..., c_ℓ, the button presses. For 1 ≤ i ≤ ℓ, 1 ≤ c_i ≤ 3.

We can show that the answer always exists.

Examples

Input

1 3 5


Output

2
1 1


Input

3 2 5


Output

1
3

Note

In the first example the integer on the screen changes as 1 → 2 → 3.

In the second example the integer on the screen changes as 3 → 2. 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int p, s, t;
int bpow(int x, int k) {
  if (k == 1) return x;
  if (k & 1) return x * 1ll * bpow(x, k - 1) % p;
  int tmp = bpow(x, k / 2);
  return tmp * 1ll * tmp % p;
}
int rev(int x) { return bpow(x, p - 2); }
int dist(int x, int y) { return min((x - y + p) % p, (y - x + p) % p); }
map<int, int> was[2];
int m[2];
int getMinDist() {
  auto l = was[0].begin();
  auto r = was[1].begin();
  m[0] = l->first;
  m[1] = r->first;
  int ret = dist(l->first, r->first);
  while (l != was[0].end() && r != was[1].end()) {
    if (ret > dist(l->first, r->first)) {
      ret = dist(l->first, r->first);
      m[0] = l->first;
      m[1] = r->first;
    }
    if (l->first < r->first)
      l++;
    else
      r++;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> t >> p;
  was[0][s] = -1;
  was[1][t] = -1;
  int itr = 0;
  while (true) {
    int d = getMinDist();
    ;
    if (d < 100) break;
    auto& cur = was[itr & 1];
    map<int, int> add;
    for (const auto& kv : cur) {
      int v = kv.first;
      vector<int> g = {(v + 1) % p, (v + p - 1) % p, rev(v)};
      for (int u : g) {
        if (cur.count(u) == 0) add[u] = v;
      }
    }
    for (const auto& kv : add) cur[kv.first] = kv.second;
    itr++;
  }
  vector<int> ans;
  int y, x = m[0];
  while ((y = was[0][x]) != -1) {
    if ((y + 1) % p == x)
      ans.push_back(1);
    else if ((y - 1 + p) % p == x)
      ans.push_back(2);
    else
      ans.push_back(3);
    x = y;
  }
  reverse(ans.begin(), ans.end());
  x = m[0], y = m[1];
  if ((y - x + p) % p < (x - y + p) % p) {
    while (x != y) {
      ans.push_back(1);
      x = (x + 1) % p;
    }
  } else {
    while (x != y) {
      ans.push_back(2);
      x = (x - 1 + p) % p;
    }
  }
  x = m[1];
  while ((y = was[1][x]) != -1) {
    if ((x + 1) % p == y)
      ans.push_back(1);
    else if ((x - 1 + p) % p == y)
      ans.push_back(2);
    else
      ans.push_back(3);
    x = y;
  }
  cout << ans.size() << endl;
  for (int x : ans) cout << x << " ";
  return 0;
}

```