#include <bits/stdc++.h>
using namespace std;
long long MOD;
long long bigmod(long long x, long long p) {
  long long ret = 1;
  while (p > 0) {
    if ((p & 1)) ret = (ret * x) % MOD;
    p >>= 1;
    x = (x * x) % MOD;
  }
  return ret;
}
long long modinverse(long long a) { return bigmod(a, MOD - 2); }
long long x, y;
int maxlevel = 17;
map<int, int> level1, level2, par1, par2, way1, way2;
queue<int> q;
vector<int> vec;
int main() {
  cin >> x >> y >> MOD;
  if (x == y) {
    cout << 0 << endl;
    return 0;
  }
  long long u, v;
  q.push(x);
  level1[x] = 1;
  par1[x] = -1;
  way1[x] = -1;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    if (level1[u] >= maxlevel) break;
    v = (u + 1) % MOD;
    if (level1.find(v) == level1.end()) {
      level1[v] = level1[u] + 1;
      par1[v] = u;
      way1[v] = 1;
      q.push(v);
    }
    v = (u + MOD - 1) % MOD;
    if (level1.find(v) == level1.end()) {
      level1[v] = level1[u] + 1;
      par1[v] = u;
      way1[v] = 2;
      q.push(v);
    }
    v = modinverse(u);
    if (level1.find(v) == level1.end()) {
      level1[v] = level1[u] + 1;
      par1[v] = u;
      way1[v] = 3;
      q.push(v);
    }
  }
  while (!q.empty()) q.pop();
  q.push(y);
  level2[y] = 1;
  par2[y] = -1;
  way2[y] = -1;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    if (level2[u] >= maxlevel) break;
    v = (u + 1) % MOD;
    if (level2.find(v) == level2.end()) {
      level2[v] = level2[u] + 1;
      par2[v] = u;
      way2[v] = 2;
      q.push(v);
    }
    v = (u + MOD - 1) % MOD;
    if (level2.find(v) == level2.end()) {
      level2[v] = level2[u] + 1;
      par2[v] = u;
      way2[v] = 1;
      q.push(v);
    }
    v = modinverse(u);
    if (level2.find(v) == level2.end()) {
      level2[v] = level2[u] + 1;
      par2[v] = u;
      way2[v] = 3;
      q.push(v);
    }
  }
  while (!q.empty()) q.pop();
  auto it = level1.begin();
  int le;
  while (it != level1.end()) {
    u = it->first;
    le = it->second;
    v = u;
    for (int i = 0; i <= 202; i++) {
      if (le + i - 1 > 200) break;
      if (level2.find(v) != level2.end()) {
        if (le + i + level2[v] - 2 <= 200) {
          int ans = le + i + level2[v] - 2;
          cout << ans << "\n";
          int now = u;
          while (now != x) {
            vec.push_back(way1[now]);
            now = par1[now];
          }
          if (!vec.empty()) reverse(vec.begin(), vec.end());
          for (int j = 1; j <= i; j++) vec.push_back(1);
          now = v;
          while (now != y) {
            vec.push_back(way2[now]);
            now = par2[now];
          }
          for (int j = 0; j < vec.size(); j++) cout << vec[j] << " ";
          return 0;
        }
      }
      v = (v + 1) % MOD;
    }
    v = u;
    for (int i = 0; i <= 202; i++) {
      if (le + i - 1 > 200) break;
      if (level2.find(v) != level2.end()) {
        if (le + i + level2[v] - 2 <= 200) {
          int ans = le + i + level2[v] - 2;
          cout << ans << "\n";
          int now = u;
          while (now != x) {
            vec.push_back(way1[now]);
            now = par1[now];
          }
          if (!vec.empty()) reverse(vec.begin(), vec.end());
          for (int j = 1; j <= i; j++) vec.push_back(2);
          now = v;
          while (now != y) {
            vec.push_back(way2[now]);
            now = par2[now];
          }
          for (int j = 0; j < vec.size(); j++) cout << vec[j] << " ";
          return 0;
        }
      }
      v = (v + MOD - 1) % MOD;
    }
    it++;
  }
  return 0;
}

### Prompt

In cpp, your task is to solve the following problem:

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;
long long MOD;
long long bigmod(long long x, long long p) {
  long long ret = 1;
  while (p > 0) {
    if ((p & 1)) ret = (ret * x) % MOD;
    p >>= 1;
    x = (x * x) % MOD;
  }
  return ret;
}
long long modinverse(long long a) { return bigmod(a, MOD - 2); }
long long x, y;
int maxlevel = 17;
map<int, int> level1, level2, par1, par2, way1, way2;
queue<int> q;
vector<int> vec;
int main() {
  cin >> x >> y >> MOD;
  if (x == y) {
    cout << 0 << endl;
    return 0;
  }
  long long u, v;
  q.push(x);
  level1[x] = 1;
  par1[x] = -1;
  way1[x] = -1;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    if (level1[u] >= maxlevel) break;
    v = (u + 1) % MOD;
    if (level1.find(v) == level1.end()) {
      level1[v] = level1[u] + 1;
      par1[v] = u;
      way1[v] = 1;
      q.push(v);
    }
    v = (u + MOD - 1) % MOD;
    if (level1.find(v) == level1.end()) {
      level1[v] = level1[u] + 1;
      par1[v] = u;
      way1[v] = 2;
      q.push(v);
    }
    v = modinverse(u);
    if (level1.find(v) == level1.end()) {
      level1[v] = level1[u] + 1;
      par1[v] = u;
      way1[v] = 3;
      q.push(v);
    }
  }
  while (!q.empty()) q.pop();
  q.push(y);
  level2[y] = 1;
  par2[y] = -1;
  way2[y] = -1;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    if (level2[u] >= maxlevel) break;
    v = (u + 1) % MOD;
    if (level2.find(v) == level2.end()) {
      level2[v] = level2[u] + 1;
      par2[v] = u;
      way2[v] = 2;
      q.push(v);
    }
    v = (u + MOD - 1) % MOD;
    if (level2.find(v) == level2.end()) {
      level2[v] = level2[u] + 1;
      par2[v] = u;
      way2[v] = 1;
      q.push(v);
    }
    v = modinverse(u);
    if (level2.find(v) == level2.end()) {
      level2[v] = level2[u] + 1;
      par2[v] = u;
      way2[v] = 3;
      q.push(v);
    }
  }
  while (!q.empty()) q.pop();
  auto it = level1.begin();
  int le;
  while (it != level1.end()) {
    u = it->first;
    le = it->second;
    v = u;
    for (int i = 0; i <= 202; i++) {
      if (le + i - 1 > 200) break;
      if (level2.find(v) != level2.end()) {
        if (le + i + level2[v] - 2 <= 200) {
          int ans = le + i + level2[v] - 2;
          cout << ans << "\n";
          int now = u;
          while (now != x) {
            vec.push_back(way1[now]);
            now = par1[now];
          }
          if (!vec.empty()) reverse(vec.begin(), vec.end());
          for (int j = 1; j <= i; j++) vec.push_back(1);
          now = v;
          while (now != y) {
            vec.push_back(way2[now]);
            now = par2[now];
          }
          for (int j = 0; j < vec.size(); j++) cout << vec[j] << " ";
          return 0;
        }
      }
      v = (v + 1) % MOD;
    }
    v = u;
    for (int i = 0; i <= 202; i++) {
      if (le + i - 1 > 200) break;
      if (level2.find(v) != level2.end()) {
        if (le + i + level2[v] - 2 <= 200) {
          int ans = le + i + level2[v] - 2;
          cout << ans << "\n";
          int now = u;
          while (now != x) {
            vec.push_back(way1[now]);
            now = par1[now];
          }
          if (!vec.empty()) reverse(vec.begin(), vec.end());
          for (int j = 1; j <= i; j++) vec.push_back(2);
          now = v;
          while (now != y) {
            vec.push_back(way2[now]);
            now = par2[now];
          }
          for (int j = 0; j < vec.size(); j++) cout << vec[j] << " ";
          return 0;
        }
      }
      v = (v + MOD - 1) % MOD;
    }
    it++;
  }
  return 0;
}

```