#include <bits/stdc++.h>
using namespace std;
struct chocolate {
  long long a, b, c;
};
chocolate a, b, rs1, rs2;
void reArrange(chocolate &x) {
  if (x.a > x.b) {
    long long t = x.a;
    x.a = x.b;
    x.b = t;
  }
}
void extend(vector<chocolate> &C) {
  map<long long, bool> d;
  d.clear();
  unsigned int i, j;
  chocolate u, v;
  d[C[0].a * C[0].b] = true;
  for (i = 0; i < C.size(); i++) {
    u = C[i];
    if (u.a % 2 == 0) {
      v = u;
      v.a = v.a / 2;
      if (d[v.a * v.b] == false) {
        reArrange(v);
        v.c++;
        d[v.a * v.b] = true;
        C.push_back(v);
      }
    }
    if (u.b % 2 == 0) {
      v = u;
      v.b = v.b / 2;
      if (d[v.a * v.b] == false) {
        reArrange(v);
        v.c++;
        d[v.a * v.b] = true;
        C.push_back(v);
      }
    }
    if (u.a % 3 == 0) {
      v = u;
      v.a = (v.a / 3) * 2;
      if (d[v.a * v.b] == false) {
        reArrange(v);
        v.c++;
        d[v.a * v.b] = true;
        C.push_back(v);
      }
    }
    if (u.b % 3 == 0) {
      v = u;
      v.b = (v.b / 3) * 2;
      if (d[v.a * v.b] == false) {
        reArrange(v);
        v.c++;
        d[v.a * v.b] = true;
        C.push_back(v);
      }
    }
  }
}
void process() {
  vector<chocolate> A, B;
  A.clear();
  B.clear();
  reArrange(a);
  reArrange(b);
  A.push_back(a);
  B.push_back(b);
  extend(A);
  extend(B);
  rs1.c = 1e9;
  rs2.c = 1e9;
  int i, j;
  for (i = 0; i < A.size(); i++)
    if (A[i].c < (rs1.c + rs2.c)) {
      for (j = 0; j < B.size(); j++)
        if ((A[i].a * A[i].b) == (B[j].a * B[j].b)) {
          if ((rs1.c + rs2.c) > (A[i].c + B[j].c)) {
            rs1 = A[i];
            rs2 = B[j];
          }
        }
    }
  if (rs1.c + rs2.c > 1e9) {
    cout << "-1";
  } else {
    cout << (rs1.c + rs2.c);
    cout << "\n" << rs1.a << " " << rs1.b;
    cout << "\n" << rs2.a << " " << rs2.b;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> a.a >> a.b;
  cin >> b.a >> b.b;
  a.c = 0;
  b.c = 0;
  process();
  cin >> a.c;
  return 0;
}
