#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a1, b1, a2, b2, i, j, k, temp, A, B, two1 = 0, two2 = 0, three1 = 0,
                                                 three2 = 0, cnt = 0;
  scanf("%I64d%I64d", &a1, &b1);
  scanf("%I64d%I64d", &a2, &b2);
  A = a1 * b1;
  B = a2 * b2;
  while (A % 2 == 0) {
    A /= 2;
    two1++;
  }
  while (B % 2 == 0) {
    B /= 2;
    two2++;
  }
  while (A % 3 == 0) {
    A /= 3;
    three1++;
  }
  while (B % 3 == 0) {
    B /= 3;
    three2++;
  }
  if (A != B) {
    printf("%s\n", "-1");
    return 0;
  };
  if (three1 > three2) {
    three1 -= three2;
    cnt += three1;
    two1 += three1;
    while (three1 > 0 && a1 % 3 == 0) {
      three1--;
      a1 -= a1 / 3;
    }
    while (three1 > 0 && b1 % 3 == 0) {
      three1--;
      b1 -= b1 / 3;
    }
  } else {
    three2 -= three1;
    cnt += three2;
    two2 += three2;
    while (three2 > 0 && a2 % 3 == 0) {
      three2--;
      a2 -= a2 / 3;
    }
    while (three2 > 0 && b2 % 3 == 0) {
      three2--;
      b2 -= b2 / 3;
    }
  }
  if (two1 > two2) {
    two1 -= two2;
    cnt += two1;
    while (two1 > 0 && a1 % 2 == 0) {
      two1--;
      a1 /= 2;
    }
    while (two1 > 0 && b1 % 2 == 0) {
      two1--;
      b1 /= 2;
    }
  } else {
    two2 -= two1;
    cnt += two2;
    while (two2 > 0 && a2 % 2 == 0) {
      two2--;
      a2 /= 2;
    }
    while (two2 > 0 && b2 % 2 == 0) {
      two2--;
      b2 /= 2;
    }
  }
  printf("%I64d\n", cnt);
  printf("%I64d %I64d\n", a1, b1);
  printf("%I64d %I64d\n", a2, b2);
  return 0;
}
