#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b;
  int c, d;
  cin >> a >> b;
  cin >> c >> d;
  int l2 = 0, l3 = 0;
  int r2 = 0, r3 = 0;
  int A = a, B = b;
  int C = c, D = d;
  while ((A % 2) == 0) l2++, A /= 2;
  while ((B % 2) == 0) l2++, B /= 2;
  while ((C % 2) == 0) r2++, C /= 2;
  while ((D % 2) == 0) r2++, D /= 2;
  while ((A % 3) == 0) l3++, A /= 3;
  while ((B % 3) == 0) l3++, B /= 3;
  while ((C % 3) == 0) r3++, C /= 3;
  while ((D % 3) == 0) r3++, D /= 3;
  int t2 = max(0, r3 - l3);
  int s2 = max(0, (r2 + r3) - (l2 + l3));
  int t1 = l3 - r3 + t2;
  int s1 = (l2 + l3) - (r2 + r3) + s2;
  for (int i = 0; i < t1; i++) {
    if ((a % 3) == 0)
      a = (2 * (long long)a) / 3;
    else if ((b % 3) == 0)
      b = (2 * (long long)b) / 3;
    else {
      cout << "-1" << endl;
      return 0;
    }
  }
  for (int i = 0; i < s1; i++) {
    if ((a % 2) == 0)
      a /= 2;
    else if ((b % 2) == 0)
      b /= 2;
    else {
      cout << "-1" << endl;
      return 0;
    }
  }
  for (int i = 0; i < t2; i++) {
    if ((c % 3) == 0)
      c = (2 * (long long)c) / 3;
    else if ((d % 3) == 0)
      d = (2 * (long long)d) / 3;
    else {
      cout << "-1" << endl;
      return 0;
    }
  }
  for (int i = 0; i < s2; i++) {
    if ((c % 2) == 0)
      c /= 2;
    else if ((d % 2) == 0)
      d /= 2;
    else {
      cout << "-1" << endl;
      return 0;
    }
  }
  if ((long long)a * (long long)b == (long long)c * (long long)d)
    cout << (t1 + t2 + s1 + s2) << endl
         << a << " " << b << endl
         << c << " " << d << endl;
  else
    cout << "-1";
  return 0;
}
