#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long a1, b1, a2, b2, x, y;
  int a = 0, b = 0, c = 0, d = 0;
  cin >> a1 >> b1;
  cin >> a2 >> b2;
  x = a1 * b1;
  while (x % 2 == 0) {
    a++;
    x /= 2;
  }
  while (x % 3 == 0) {
    b++;
    x /= 3;
  }
  y = a2 * b2;
  while (y % 2 == 0) {
    c++;
    y /= 2;
  }
  while (y % 3 == 0) {
    d++;
    y /= 3;
  }
  if (x != y) {
    cout << -1 << endl;
    return 0;
  }
  int ans = 0, opa = 0, opb = 0, opc = 0, opd = 0;
  if (b < d) {
    ans += d - b;
    c += ans;
    opd = ans;
  } else if (b > d) {
    ans += b - d;
    a += ans;
    opb = ans;
  }
  if (a < c) {
    ans += c - a;
    opc = c - a;
  } else if (a > c) {
    ans += a - c;
    opa = a - c;
  }
  cout << ans << endl;
  for (int i = 0; i < opb; ++i) {
    if (a1 % 3 == 0)
      a1 = (a1 * 2) / 3;
    else
      b1 = (b1 * 2) / 3;
  }
  for (int i = 0; i < opa; ++i) {
    if (a1 % 2 == 0)
      a1 /= 2;
    else
      b1 /= 2;
  }
  for (int i = 0; i < opd; ++i) {
    if (a2 % 3 == 0)
      a2 = (a2 * 2) / 3;
    else
      b2 = (b2 * 2) / 3;
  }
  for (int i = 0; i < opc; ++i) {
    if (a2 % 2 == 0)
      a2 /= 2;
    else
      b2 /= 2;
  }
  cout << a1 << " " << b1 << endl;
  cout << a2 << " " << b2 << endl;
  return 0;
}
