#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, q1, w, w1, e, r, c = 0, c1 = 0, v = 0, v1 = 0, t, y, t1, y1,
                                u = 0;
  cin >> q >> w >> q1 >> w1;
  t = q;
  y = w;
  t1 = q1;
  y1 = w1;
  for (; q % 2 == 0; q /= 2) c++;
  for (; w % 2 == 0; w /= 2) c++;
  for (; q % 3 == 0; q /= 3) v++;
  for (; w % 3 == 0; w /= 3) v++;
  for (; q1 % 2 == 0; q1 /= 2) c1++;
  for (; w1 % 2 == 0; w1 /= 2) c1++;
  for (; q1 % 3 == 0; q1 /= 3) v1++;
  for (; w1 % 3 == 0; w1 /= 3) v1++;
  if (q * w != q1 * w1) {
    cout << -1;
    return 0;
  }
  for (; v > v1;) {
    if (t % 3 == 0)
      t = (t / 3) * 2;
    else
      y = (y / 3) * 2;
    v--;
    c++;
    u++;
  }
  for (; v < v1;) {
    if (t1 % 3 == 0)
      t1 = (t1 / 3) * 2;
    else
      y1 = (y1 / 3) * 2;
    v1--;
    c1++;
    u++;
  }
  for (; c > c1;) {
    if (t % 2 == 0)
      t /= 2;
    else
      y /= 2;
    c--;
    u++;
  }
  for (; c < c1;) {
    if (t1 % 2 == 0)
      t1 /= 2;
    else
      y1 /= 2;
    c1--;
    u++;
  }
  cout << u << "\n" << t << " " << y << "\n" << t1 << " " << y1;
  return 0;
}
