#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
template <typename T>
inline istream& operator>>(istream& i, vector<T>& v) {
  for (int j = 0; j < ((int)(v).size()); ++j) i >> v[j];
  return i;
}
template <typename T>
string join(const vector<T>& v) {
  stringstream s;
  for (int i = 0; i < ((int)(v).size()); ++i) s << ' ' << v[i];
  return s.str().substr(1);
}
template <typename T>
inline ostream& operator<<(ostream& o, const vector<T>& v) {
  if ((int)(v).size()) o << join(v);
  return o;
}
template <typename T1, typename T2>
inline istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}
template <typename T1, typename T2>
inline ostream& operator<<(ostream& o, const pair<T1, T2>& v) {
  return o << v.first << "," << v.second;
}
template <typename T>
inline long long int suma(const vector<T>& a) {
  long long int res(0);
  for (auto&& x : a) res += x;
  return res;
}
const double eps = 1e-10;
const long long int LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
int mod;
struct mint {
  long long int x;
  mint() : x(0) {}
  mint(long long int x) : x((x % mod + mod) % mod) {}
  mint& fix() {
    x = (x % mod + mod) % mod;
    return *this;
  }
  mint& operator+=(const mint& a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint& a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/=(const mint& a) {
    (x *= a.ex(mod - 2).x) %= mod;
    return *this;
  }
  mint operator+(const mint& a) const { return mint(*this) += a; }
  mint operator-(const mint& a) const { return mint(*this) -= a; }
  mint operator*(const mint& a) const { return mint(*this) *= a; }
  mint operator/(const mint& a) const { return mint(*this) /= a; }
  mint ex(long long int t) const {
    if (!t) return 1;
    mint res = ex(t / 2);
    res *= res;
    return (t & 1) ? res * x : res;
  }
  bool operator<(const mint& a) const { return x < a.x; }
  bool operator==(const mint& a) const { return x == a.x; }
};
mint ex(mint x, long long int t) { return x.ex(t); }
istream& operator>>(istream& i, mint& a) {
  i >> a.x;
  return i;
}
ostream& operator<<(ostream& o, const mint& a) {
  o << a.x;
  return o;
}
int main() {
  int s, t;
  scanf("%d%d%d", &s, &t, &mod);
  if (s == t) {
    cout << 0 << endl;
    return 0;
  }
  map<int, int> d;
  vector<int> qs(1, s), qt(1, t);
  d[s] = 0;
  d[t] = 1;
  auto output = [&](int x, int y, int ns) {
    if (ns & 1) swap(x, y);
    vector<int> ans;
    if (~ns & 1) ans.push_back(ns / 2);
    while (1) {
      int w = d[x] / 2;
      if (w == 0) break;
      ans.push_back(w);
      if (w == 1) x = (x + mod - 1) % mod;
      if (w == 2) x = (x + 1) % mod;
      if (w == 3) x = ex(x, mod - 2).x;
    }
    reverse(ans.begin(), ans.end());
    if (ns & 1) {
      ans.push_back(ns / 2);
      if (ans.back() != 3) ans.back() ^= 3;
    }
    x = y;
    while (1) {
      int w = d[x] / 2;
      if (w == 0) break;
      if (w != 3) w ^= 3;
      ans.push_back(w);
      if (w == 1) x = (x + 1) % mod;
      if (w == 2) x = (x + mod - 1) % mod;
      if (w == 3) x = ex(x, mod - 2).x;
    }
    cout << (int)(ans).size() << endl;
    cout << ans << endl;
  };
  int ti = 0;
  while (1) {
    vector<int> q;
    swap(qs, q);
    for (int i = 0; i < ((int)(q).size()); ++i) {
      int x = q[i];
      {
        int nx = (x + 1) % mod;
        int ns = 2 + ti;
        if (!d.count(nx)) {
          d[nx] = ns;
          qs.push_back(nx);
        } else if ((d[nx] & 1) != ti) {
          output(x, nx, ns);
          return 0;
        }
      }
      {
        int nx = (x + mod - 1) % mod;
        int ns = 4 + ti;
        if (!d.count(nx)) {
          d[nx] = ns;
          qs.push_back(nx);
        } else if ((d[nx] & 1) != ti) {
          output(x, nx, ns);
          return 0;
        }
      }
      {
        int nx = ex(x, mod - 2).x;
        int ns = 6 + ti;
        if (!d.count(nx)) {
          d[nx] = ns;
          qs.push_back(nx);
        } else if ((d[nx] & 1) != ti) {
          output(x, nx, ns);
          return 0;
        }
      }
    }
    swap(qs, qt);
    ti ^= 1;
  }
  return 0;
}

### Prompt

Please create a solution in CPP to 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;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
template <typename T>
inline istream& operator>>(istream& i, vector<T>& v) {
  for (int j = 0; j < ((int)(v).size()); ++j) i >> v[j];
  return i;
}
template <typename T>
string join(const vector<T>& v) {
  stringstream s;
  for (int i = 0; i < ((int)(v).size()); ++i) s << ' ' << v[i];
  return s.str().substr(1);
}
template <typename T>
inline ostream& operator<<(ostream& o, const vector<T>& v) {
  if ((int)(v).size()) o << join(v);
  return o;
}
template <typename T1, typename T2>
inline istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}
template <typename T1, typename T2>
inline ostream& operator<<(ostream& o, const pair<T1, T2>& v) {
  return o << v.first << "," << v.second;
}
template <typename T>
inline long long int suma(const vector<T>& a) {
  long long int res(0);
  for (auto&& x : a) res += x;
  return res;
}
const double eps = 1e-10;
const long long int LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
int mod;
struct mint {
  long long int x;
  mint() : x(0) {}
  mint(long long int x) : x((x % mod + mod) % mod) {}
  mint& fix() {
    x = (x % mod + mod) % mod;
    return *this;
  }
  mint& operator+=(const mint& a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint& a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/=(const mint& a) {
    (x *= a.ex(mod - 2).x) %= mod;
    return *this;
  }
  mint operator+(const mint& a) const { return mint(*this) += a; }
  mint operator-(const mint& a) const { return mint(*this) -= a; }
  mint operator*(const mint& a) const { return mint(*this) *= a; }
  mint operator/(const mint& a) const { return mint(*this) /= a; }
  mint ex(long long int t) const {
    if (!t) return 1;
    mint res = ex(t / 2);
    res *= res;
    return (t & 1) ? res * x : res;
  }
  bool operator<(const mint& a) const { return x < a.x; }
  bool operator==(const mint& a) const { return x == a.x; }
};
mint ex(mint x, long long int t) { return x.ex(t); }
istream& operator>>(istream& i, mint& a) {
  i >> a.x;
  return i;
}
ostream& operator<<(ostream& o, const mint& a) {
  o << a.x;
  return o;
}
int main() {
  int s, t;
  scanf("%d%d%d", &s, &t, &mod);
  if (s == t) {
    cout << 0 << endl;
    return 0;
  }
  map<int, int> d;
  vector<int> qs(1, s), qt(1, t);
  d[s] = 0;
  d[t] = 1;
  auto output = [&](int x, int y, int ns) {
    if (ns & 1) swap(x, y);
    vector<int> ans;
    if (~ns & 1) ans.push_back(ns / 2);
    while (1) {
      int w = d[x] / 2;
      if (w == 0) break;
      ans.push_back(w);
      if (w == 1) x = (x + mod - 1) % mod;
      if (w == 2) x = (x + 1) % mod;
      if (w == 3) x = ex(x, mod - 2).x;
    }
    reverse(ans.begin(), ans.end());
    if (ns & 1) {
      ans.push_back(ns / 2);
      if (ans.back() != 3) ans.back() ^= 3;
    }
    x = y;
    while (1) {
      int w = d[x] / 2;
      if (w == 0) break;
      if (w != 3) w ^= 3;
      ans.push_back(w);
      if (w == 1) x = (x + 1) % mod;
      if (w == 2) x = (x + mod - 1) % mod;
      if (w == 3) x = ex(x, mod - 2).x;
    }
    cout << (int)(ans).size() << endl;
    cout << ans << endl;
  };
  int ti = 0;
  while (1) {
    vector<int> q;
    swap(qs, q);
    for (int i = 0; i < ((int)(q).size()); ++i) {
      int x = q[i];
      {
        int nx = (x + 1) % mod;
        int ns = 2 + ti;
        if (!d.count(nx)) {
          d[nx] = ns;
          qs.push_back(nx);
        } else if ((d[nx] & 1) != ti) {
          output(x, nx, ns);
          return 0;
        }
      }
      {
        int nx = (x + mod - 1) % mod;
        int ns = 4 + ti;
        if (!d.count(nx)) {
          d[nx] = ns;
          qs.push_back(nx);
        } else if ((d[nx] & 1) != ti) {
          output(x, nx, ns);
          return 0;
        }
      }
      {
        int nx = ex(x, mod - 2).x;
        int ns = 6 + ti;
        if (!d.count(nx)) {
          d[nx] = ns;
          qs.push_back(nx);
        } else if ((d[nx] & 1) != ti) {
          output(x, nx, ns);
          return 0;
        }
      }
    }
    swap(qs, qt);
    ti ^= 1;
  }
  return 0;
}

```