#include <bits/stdc++.h>
using namespace std;
const int MAXN = 511111;
const int MOD = 1e9 + 7;
const double eps = 1e-6;
const long long MAXL = (long long)(0x7fffffffffffffff);
const int MAXI = 0x7fffffff;
long long a1, b1, a2, b2;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  while (cin >> a1 >> b1 >> a2 >> b2) {
    long long s1 = a1 * b1, s2 = a2 * b2;
    int ans = -1, x2 = 0, x3 = 0, y2 = 0, y3 = 0;
    long long q1 = s1, q2 = s2;
    for (int three1 = 0; three1 <= 60 && q1 > 0; three1++) {
      if (three1 > 0) {
        if (q1 % 3 != 0) break;
        q1 = q1 / 3 * 2;
      }
      long long w1 = q1;
      for (int two1 = 0; two1 <= 200 && w1 > 0; two1++) {
        if (two1 > 0) {
          if (w1 % 2 != 0) break;
          w1 /= 2;
        }
        q2 = s2;
        for (int three2 = 0; three2 <= 60 && q2 > 0; three2++) {
          if (three2 > 0) {
            if (q2 % 3 != 0) break;
            q2 = q2 / 3 * 2;
          }
          long long w2 = q2;
          for (int two2 = 0; two2 <= 200 && w2 > 0; two2++) {
            if (two2 > 0) {
              if (w2 % 2 != 0) break;
              w2 /= 2;
            }
            if (w1 == w2 &&
                (ans == -1 || three1 + three2 + two2 + two1 < ans)) {
              ans = three1 + three2 + two2 + two1;
              x3 = three1, x2 = two1, y3 = three2, y2 = two2;
            }
          }
        }
      }
    }
    cout << ans << endl;
    if (ans != -1) {
      while (x3 > 0) {
        if (a1 % 3 == 0)
          a1 = a1 / 3 * 2;
        else
          b1 = b1 / 3 * 2;
        x3--;
      }
      while (x2 > 0) {
        if (a1 % 2 == 0)
          a1 /= 2;
        else
          b1 /= 2;
        x2--;
      }
      while (y3 > 0) {
        if (a2 % 3 == 0)
          a2 = a2 / 3 * 2;
        else
          b2 = b2 / 3 * 2;
        y3--;
      }
      while (y2 > 0) {
        if (a2 % 2 == 0)
          a2 /= 2;
        else
          b2 /= 2;
        y2--;
      }
      cout << a1 << " " << b1 << endl;
      cout << a2 << " " << b2 << endl;
    }
  }
}
