#include <bits/stdc++.h>
using namespace std;
unsigned long long int cnt(unsigned long long int x, int& n2, int& n3) {
  n2 = 0;
  n3 = 0;
  while (x > 0 && ((x % 2) == 0)) {
    ++n2;
    x /= 2;
  }
  while (x > 0 && ((x % 3) == 0)) {
    ++n3;
    x /= 3;
  }
  return x;
}
int main() {
  unsigned long long int a1, b1, a2, b2;
  scanf("%I64u%I64u%I64u%I64u", &a1, &b1, &a2, &b2);
  int n12, n13;
  int n22, n23;
  unsigned long long int rem1 = cnt(a1 * b1, n12, n13);
  unsigned long long int rem2 = cnt(a2 * b2, n22, n23);
  if (rem1 != rem2) {
    printf("-1\n");
    return 0;
  }
  int res = 0;
  int d3 = n13 - n23;
  res += abs(d3);
  if (d3 > 0) {
    n12 += d3;
    while (d3 > 0 && (a1 % 3) == 0) {
      a1 /= 3;
      a1 *= 2;
      --d3;
    }
    while (d3 > 0 && (b1 % 3) == 0) {
      b1 /= 3;
      b1 *= 2;
      --d3;
    }
  }
  if (d3 < 0) {
    d3 = -d3;
    n22 += d3;
    while (d3 > 0 && (a2 % 3) == 0) {
      a2 /= 3;
      a2 *= 2;
      --d3;
    }
    while (d3 > 0 && (b2 % 3) == 0) {
      b2 /= 3;
      b2 *= 2;
      --d3;
    }
  }
  int d2 = n12 - n22;
  res += abs(d2);
  if (d2 > 0) {
    while (d2 > 0 && (a1 % 2) == 0) {
      a1 /= 2;
      --d2;
    }
    while (d2 > 0 && (b1 % 2) == 0) {
      b1 /= 2;
      --d2;
    }
  }
  if (d2 < 0) {
    d2 = -d2;
    while (d2 > 0 && (a2 % 2) == 0) {
      a2 /= 2;
      --d2;
    }
    while (d2 > 0 && (b2 % 2) == 0) {
      b2 /= 2;
      --d2;
    }
  }
  printf("%d\n", res);
  printf("%I64u %I64u\n", a1, b1);
  printf("%I64u %I64u\n", a2, b2);
}
