#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a1, a2, b1, b2;
  long long int c12 = 0, c13 = 0, c22 = 0, c23 = 0;
  long long int steps = 0;
  cin >> a1 >> a2 >> b1 >> b2;
  long long int A = a1 * a2;
  long long int B = b1 * b2;
  while (A % 2 == 0) {
    A /= 2;
    c12++;
  }
  while (A % 3 == 0) {
    A /= 3;
    c13++;
  }
  while (B % 2 == 0) {
    B /= 2;
    c22++;
  }
  while (B % 3 == 0) {
    B /= 3;
    c23++;
  }
  if (A != B) {
    cout << "-1" << endl;
    return 0;
  }
  if (c13 > c23) {
    while (c13 != c23 && (a1 % 3) == 0) {
      a1 /= 3;
      c13--;
      a1 *= 2;
      steps++;
      c12++;
    }
    while (c13 != c23 && (a2 % 3) == 0) {
      a2 /= 3;
      c13--;
      a2 *= 2;
      steps++;
      c12++;
    }
  } else if (c13 < c23) {
    while (c13 != c23 && (b1 % 3) == 0) {
      b1 /= 3;
      c23--;
      b1 *= 2;
      steps++;
      c22++;
    }
    while (c13 != c23 && (b2 % 3) == 0) {
      b2 /= 3;
      c23--;
      b2 *= 2;
      steps++;
      c22++;
    }
  }
  if (c12 > c22) {
    while (c12 != c22 && (a1 % 2) == 0) {
      a1 /= 2;
      c12--;
      steps++;
    }
    while (c12 != c22 && (a2 % 2) == 0) {
      a2 /= 2;
      c12--;
      steps++;
    }
  } else if (c12 < c22) {
    while (c22 != c12 && (b1 % 2) == 0) {
      b1 /= 2;
      c22--;
      steps++;
    }
    while (c22 != c12 && (b2 % 2) == 0) {
      b2 /= 2;
      c22--;
      steps++;
    }
  }
  cout << steps << endl;
  cout << a1 << " " << a2 << endl;
  cout << b1 << " " << b2 << endl;
  return 0;
}
