#include <bits/stdc++.h>
using namespace std;
int main() {
  int a1, a2, b1, b2, x1, x2, y1, y2, sum12 = 0, sum22 = 0, sum23 = 0,
                                      sum13 = 0;
  cin >> a1 >> b1 >> a2 >> b2;
  x1 = a1, x2 = a2, y1 = b1, y2 = b2;
  while (a1 % 3 == 0) {
    sum13++;
    a1 /= 3;
    a1 *= 2;
  }
  while (a1 % 2 == 0) {
    sum12++;
    a1 /= 2;
  }
  while (b1 % 3 == 0) {
    sum13++;
    b1 /= 3;
    b1 *= 2;
  }
  while (b1 % 2 == 0) {
    sum12++;
    b1 /= 2;
  }
  while (a2 % 3 == 0) {
    sum23++;
    a2 /= 3;
    a2 *= 2;
  }
  while (a2 % 2 == 0) {
    sum22++;
    a2 /= 2;
  }
  while (b2 % 3 == 0) {
    sum23++;
    b2 /= 3;
    b2 *= 2;
  }
  while (b2 % 2 == 0) {
    sum22++;
    b2 /= 2;
  }
  int k = abs(sum13 - sum23);
  if (sum13 > sum23) {
    while (k--) {
      if (x1 % 3 == 0) {
        x1 /= 3;
        x1 *= 2;
      } else if (y1 % 3 == 0) {
        y1 /= 3;
        y1 *= 2;
      }
    }
  } else {
    while (k--) {
      if (x2 % 3 == 0) {
        x2 /= 3;
        x2 *= 2;
      } else if (y2 % 3 == 0) {
        y2 /= 3;
        y2 *= 2;
      }
    }
  }
  k = abs(sum12 - sum22);
  if (sum12 > sum22) {
    while (k--) {
      if (x1 % 2 == 0) {
        x1 /= 2;
      } else if (y1 % 2 == 0) {
        y1 /= 2;
      }
    }
  } else {
    while (k--) {
      if (x2 % 2 == 0) {
        x2 /= 2;
      } else if (y2 % 2 == 0) {
        y2 /= 2;
      }
    }
  }
  if (x1 * y1 != x2 * y2)
    printf("-1\n");
  else
    printf("%d\n%d %d\n%d %d\n", abs(sum12 - sum22) + abs(sum23 - sum13), x1,
           y1, x2, y2);
  return 0;
}
