#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
long long arr[100009];
map<long long, map<long long, long long> > dp;
int main() {
  long long a, b, c, d, ans = 0, ab, cd, a1, a2, b1, b2, b3;
  cin >> a >> b >> c >> d;
  a1 = b2 = a2 = b1 = 0;
  ab = a * b;
  cd = c * d;
  while (ab >= 1 and ab % 3 == 0) ab = ab / 3 * 2, a1++;
  while (ab >= 1 and ab % 2 == 0) ab = ab / 2, a2++;
  while (cd >= 1 and cd % 3 == 0) cd = cd / 3 * 2, b1++;
  while (cd >= 1 and cd % 2 == 0) cd = cd / 2, b2++;
  ans = abs(a1 - b1) + abs(a2 - b2);
  if (a1 >= b1)
    a1 -= b1, b1 = 0;
  else
    b1 -= a1, a1 = 0;
  while (a1 >= 1) {
    if (a % 3 == 0)
      a = a / 3 * 2;
    else
      b = b / 3 * 2;
    a1--;
  }
  while (b1 >= 1) {
    if (c % 3 == 0)
      c = c / 3 * 2;
    else
      d = d / 3 * 2;
    b1--;
  }
  if (a2 >= b2)
    a2 -= b2, b2 = 0;
  else
    b2 -= a2, a2 = 0;
  while (a2 >= 1) {
    if (a % 2 == 0)
      a = a / 2;
    else
      b = b / 2;
    a2--;
  }
  while (b2 >= 1) {
    if (c % 2 == 0)
      c = c / 2;
    else
      d = d / 2;
    b2--;
  }
  if (a * b != c * d) {
    cout << "-1" << endl;
    return 0;
  }
  cout << ans << endl << a << " " << b << endl << c << " " << d << endl;
  return 0;
}
