#include <bits/stdc++.h>
using namespace std;
long long int a1, b1, a2, b2;
int main() {
  scanf("%lld %lld", &a1, &b1);
  scanf("%lld %lld", &a2, &b2);
  long long int p, q, ans = 0;
  p = (a1 * b1);
  q = (a2 * b2);
  long long int tp = 0, tq = 0, thp = 0, thq = 0;
  while ((p % 3) == 0) {
    p = (p / 3);
    thp++;
  }
  while ((q % 3) == 0) {
    q = (q / 3);
    thq++;
  }
  while ((p % 2) == 0) {
    p = (p / 2);
    tp++;
  }
  while ((q % 2) == 0) {
    q = (q / 2);
    tq++;
  }
  p = (a1 * b1);
  q = (a2 * b2);
  long long int x;
  if (thp > thq) {
    tp = tp + (thp - thq);
    ans = ans + (thp - thq);
    x = (thp - thq);
    while (x--) {
      if ((a1 % 3) == 0)
        a1 = ((a1 / 3) * 2);
      else
        b1 = ((b1 / 3) * 2);
    }
  } else if (thq > thp) {
    tq = tq + (thq - thp);
    ans = ans + (thq - thp);
    x = (thq - thp);
    while (x--) {
      if ((a2 % 3) == 0)
        a2 = ((a2 / 3) * 2);
      else
        b2 = ((b2 / 3) * 2);
    }
  }
  if (tp > tq) {
    ans = ans + (tp - tq);
    x = (tp - tq);
    while (x--) {
      if ((a1 % 2) == 0)
        a1 = (a1 / 2);
      else
        b1 = (b1 / 2);
    }
  } else {
    ans = ans + (tq - tp);
    x = (tq - tp);
    while (x--) {
      if ((a2 % 2) == 0)
        a2 = (a2 / 2);
      else
        b2 = (b2 / 2);
    }
  }
  if ((a1 * b1) == (a2 * b2)) {
    printf("%lld\n", ans);
    printf("%lld %lld\n", a1, b1);
    printf("%lld %lld\n", a2, b2);
  } else
    printf("-1\n");
  return 0;
}
