#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:133217728")
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int a, b, aa, bb;
  cin >> a >> b >> aa >> bb;
  int c12 = 0, c13 = 0;
  int c22 = 0, c23 = 0;
  long long t1 = 1LL * a * b;
  while (!(t1 % 3)) t1 /= 3, t1 *= 2, c13++;
  while (!(t1 % 2)) t1 /= 2, c12++;
  long long t2 = 1LL * aa * bb;
  while (!(t2 % 3)) t2 /= 3, t2 *= 2, c23++;
  while (!(t2 % 2)) t2 /= 2, c22++;
  if (t1 != t2) {
    cout << -1 << endl;
    return 0;
  }
  cout << abs(c12 - c22) + abs(c13 - c23) << endl;
  while (c13 != c23) {
    if (c13 > c23) {
      c13--;
      if (a % 3)
        b /= 3, b *= 2;
      else
        a /= 3, a *= 2;
    } else {
      c23--;
      if (aa % 3)
        bb /= 3, bb *= 2;
      else
        aa /= 3, aa *= 2;
    }
  }
  while (c12 != c22) {
    if (c12 > c22) {
      c12--;
      if (a & 1)
        b /= 2;
      else
        a /= 2;
    } else {
      c22--;
      if (aa & 1)
        bb /= 2;
      else
        aa /= 2;
    }
  }
  cout << a << " " << b << endl;
  cout << aa << " " << bb << endl;
  return 0;
}
