#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  long long a1, b1, a2, b2;
  cin >> a1 >> b1 >> a2 >> b2;
  long long s1 = a1 * b1;
  long long s2 = a2 * b2;
  int c12, c13, c22, c23;
  c12 = c13 = c22 = c23 = 0;
  while (s1 % 3 == 0) {
    s1 /= 3;
    s1 *= 2;
    c13++;
  }
  while (s1 % 2 == 0) {
    s1 /= 2;
    c12++;
  }
  while (s2 % 3 == 0) {
    s2 /= 3;
    s2 *= 2;
    c23++;
  }
  while (s2 % 2 == 0) {
    s2 /= 2;
    c22++;
  }
  if (s1 != s2) {
    cout << -1 << "\n";
    return 0;
  }
  cout << abs(c12 - c22) + abs(c13 - c23) << "\n";
  while (c13 > c23) {
    if (a1 % 3 == 0) {
      a1 /= 3;
      a1 *= 2;
    } else {
      b1 /= 3;
      b1 *= 2;
    }
    c13--;
  }
  while (c13 < c23) {
    if (a2 % 3 == 0) {
      a2 /= 3;
      a2 *= 2;
    } else {
      b2 /= 3;
      b2 *= 2;
    }
    c23--;
  }
  while (c12 > c22) {
    if (a1 % 2 == 0)
      a1 /= 2;
    else
      b1 /= 2;
    c12--;
  }
  while (c12 < c22) {
    if (a2 % 2 == 0)
      a2 /= 2;
    else
      b2 /= 2;
    c22--;
  }
  cout << a1 << " " << b1 << "\n";
  cout << a2 << " " << b2 << "\n";
  return 0;
}
