#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d;
int main() {
  scanf("%I64d %I64d", &a, &b);
  scanf("%I64d %I64d", &c, &d);
  long long size1 = a * b;
  long long size2 = c * d;
  int second;
  second = 0;
  while (size1 % 3 == 0 && size2 % 3 == 0) {
    size1 = size1 * 2 / 3;
    size2 = size2 * 2 / 3;
  }
  while (size1 % 3 == 0) {
    size1 = size1 * 2 / 3;
    if (a % 3 == 0)
      a = a * 2 / 3;
    else
      b = b * 2 / 3;
    second += 1;
  }
  while (size2 % 3 == 0) {
    size2 = size2 * 2 / 3;
    if (c % 3 == 0)
      c = c * 2 / 3;
    else
      d = d * 2 / 3;
    second += 1;
  }
  while (size1 % 2 == 0 && size2 % 2 == 0) {
    size1 = size1 * 1 / 2;
    size2 = size2 * 1 / 2;
  }
  while (size1 % 2 == 0) {
    size1 = size1 * 1 / 2;
    if (a % 2 == 0)
      a = a * 1 / 2;
    else
      b = b * 1 / 2;
    second += 1;
  }
  while (size2 % 2 == 0) {
    size2 = size2 * 1 / 2;
    if (c % 2 == 0)
      c = c * 1 / 2;
    else
      d = d * 1 / 2;
    second += 1;
  }
  if (size1 != size2) {
    printf("-1");
  } else {
    printf("%d\n", second);
    printf("%I64d %I64d\n", a, b);
    printf("%I64d %I64d\n", c, d);
  }
  return 0;
}
