#include <bits/stdc++.h>
using namespace std;
int s1[10];
int s2[10];
int main() {
  int i, j, k, n, m, t, a1, a2, b1, b2, pos;
  pos = 0;
  scanf("%d%d%d%d", &a1, &b1, &a2, &b2);
  long long L1, L2;
  L1 = 1LL * a1 * b1;
  L2 = 1LL * a2 * b2;
  while (L1 % 2 == 0 || L1 % 3 == 0) {
    if (L1 % 2 == 0) {
      s1[2]++;
      L1 /= 2;
    }
    if (L1 % 3 == 0) {
      s1[3]++;
      L1 /= 3;
    }
  }
  while (L2 % 2 == 0 || L2 % 3 == 0) {
    if (L2 % 2 == 0) {
      s2[2]++;
      L2 /= 2;
    }
    if (L2 % 3 == 0) {
      s2[3]++;
      L2 /= 3;
    }
  }
  if (L1 != L2) {
    printf("-1\n");
    return 0;
  }
  if (s1[3] > s2[3]) {
    k = s1[3] - s2[3];
    pos = k;
    s1[2] += k;
    while (k--) {
      if (a1 % 3 == 0)
        a1 = a1 / 3 * 2;
      else
        b1 = b1 / 3 * 2;
    }
  } else {
    k = s2[3] - s1[3];
    s2[2] += k;
    pos = k;
    while (k--) {
      if (a2 % 3 == 0)
        a2 = a2 / 3 * 2;
      else
        b2 = b2 / 3 * 2;
    }
  }
  t = pos + (s1[2] > s2[2] ? (s1[2] - s2[2]) : (-s1[2] + s2[2]));
  if (s1[2] > s2[2]) {
    k = s1[2] - s2[2];
    while (k--) {
      if (a1 % 2 == 0)
        a1 /= 2;
      else
        b1 /= 2;
    }
  } else {
    k = -s1[2] + s2[2];
    while (k--) {
      if (a2 % 2 == 0)
        a2 /= 2;
      else
        b2 /= 2;
    }
  }
  printf("%d\n", t);
  printf("%d %d\n", a1, b1);
  printf("%d %d\n", a2, b2);
  return 0;
}
