#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
int a, b, a1, b1;
vector<pair<int, int> > A, B, A1, B1;
vector<pair<int, int> > factorize(int x) {
  vector<pair<int, int> > f;
  for (int i = (2); i <= (sqrt(x)); ++i)
    if (x % i == 0) {
      int cnt = 0;
      while (x % i == 0) x /= i, cnt++;
      f.emplace_back(i, cnt);
    }
  if (x != 1) f.emplace_back(x, 1);
  return f;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> a >> b >> a1 >> b1;
  A = factorize(a);
  B = factorize(b);
  A1 = factorize(a1);
  B1 = factorize(b1);
  int a2 = 0, b2 = 0, a3 = 0, b3 = 0, a12 = 0, a13 = 0, b12 = 0, b13 = 0;
  for (pair<int, int> v : A)
    if (v.first == 2)
      a2 = v.second;
    else if (v.first == 3)
      a3 = v.second;
  for (pair<int, int> v : B)
    if (v.first == 2)
      b2 = v.second;
    else if (v.first == 3)
      b3 = v.second;
  for (pair<int, int> v : A1)
    if (v.first == 2)
      a12 = v.second;
    else if (v.first == 3)
      a13 = v.second;
  for (pair<int, int> v : B1)
    if (v.first == 2)
      b12 = v.second;
    else if (v.first == 3)
      b13 = v.second;
  ll AB = a * 1LL * b / (1LL << (a2 + b2));
  for (int i = (1); i <= (a3 + b3); ++i) AB /= 3;
  ll AB1 = a1 * 1LL * b1 / (1LL << (a12 + b12));
  for (int i = (1); i <= (a13 + b13); ++i) AB1 /= 3;
  if (AB != AB1)
    cout << -1;
  else {
    int t2 = a2 + b2, t3 = a3 + b3, t12 = a12 + b12, t13 = a13 + b13, ans = 0;
    if (t3 > t13) {
      for (int i = (1); i <= (t3 - t13); ++i)
        if (a % 3 == 0)
          a = a * 2 / 3;
        else
          b = b * 2 / 3;
      ans += t3 - t13;
      t2 += t3 - t13;
    } else if (t3 < t13) {
      for (int i = (1); i <= (t13 - t3); ++i)
        if (a1 % 3 == 0)
          a1 = a1 * 2 / 3;
        else
          b1 = b1 * 2 / 3;
      t12 += t13 - t3;
      ans += t13 - t3;
    }
    if (t2 > t12) {
      for (int i = (1); i <= (t2 - t12); ++i)
        if (a % 2 == 0)
          a >>= 1;
        else
          b >>= 1;
      ans += t2 - t12;
    } else if (t2 < t12) {
      for (int i = (1); i <= (t12 - t2); ++i)
        if (a1 % 2 == 0)
          a1 >>= 1;
        else
          b1 >>= 1;
      ans += t12 - t2;
    }
    cout << ans << '\n' << a << ' ' << b << '\n' << a1 << ' ' << b1;
  }
  return 0;
}
