#include <bits/stdc++.h>
using namespace std;
long long gcd(long long n, long long m) { return m == 0 ? n : gcd(m, n % m); }
int main() {
  long long a, b, c, d;
  while (scanf("%I64d %I64d %I64d %I64d", &a, &b, &c, &d) > 0) {
    long long g = gcd(a * b, c * d), x = a * b / g, y = c * d / g;
    int cx2 = 0, cx3 = 0, cy2 = 0, cy3 = 0;
    while (x % 3 == 0) {
      x /= 3;
      x *= 2;
      cx3++;
    }
    while (y % 3 == 0) {
      y /= 3;
      y *= 2;
      cy3++;
    }
    g = gcd(x, y);
    x /= g;
    y /= g;
    while (x % 2 == 0) {
      x /= 2;
      cx2++;
    }
    while (y % 2 == 0) {
      y /= 2;
      cy2++;
    }
    if (x == y) {
      printf("%d\n", cx2 + cx3 + cy2 + cy3);
      while (a % 3 == 0 && cx3) {
        a = a / 3 * 2;
        cx3--;
      }
      while (b % 3 == 0 && cx3) {
        b = b / 3 * 2;
        cx3--;
      }
      while (a % 2 == 0 && cx2) {
        a /= 2;
        cx2--;
      }
      while (b % 2 == 0 && cx2) {
        b /= 2;
        cx2--;
      }
      while (c % 3 == 0 && cy3) {
        c = c / 3 * 2;
        cy3--;
      }
      while (d % 3 == 0 && cy3) {
        d = d / 3 * 2;
        cy3--;
      }
      while (c % 2 == 0 && cy2) {
        c /= 2;
        cy2--;
      }
      while (d % 2 == 0 && cy2) {
        d /= 2;
        cy2--;
      }
      printf("%I64d %I64d\n", a, b);
      printf("%I64d %I64d\n", c, d);
    } else
      printf("-1\n");
  }
  return 0;
}
