#include <bits/stdc++.h>
using namespace std;
int check(long long a, long long b) {
  if (a < b) swap(a, b);
  int ans = 0;
  while (a > b && a % 2 == 0) a /= 2, ++ans;
  if (a != b) return -1;
  return ans;
}
int main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  int tw1 = 0, tw2 = 0, th1 = 0, th2 = 0;
  long long x = 1LL * b * a, y;
  while (x % 2 == 0) ++tw1, x /= 2;
  while (x % 3 == 0) ++th1, x /= 3;
  x = 1LL * c * d;
  while (x % 2 == 0) ++tw2, x /= 2;
  while (x % 3 == 0) ++th2, x /= 3;
  x = 1LL * a * b;
  int ans = 0x3f3f3f3f, ii = 0, jj = 0;
  for (int i = 0; i <= th1; ++i) {
    if (i) x /= 3, x *= 2;
    y = 1LL * c * d;
    for (int j = 0; j <= th2; ++j) {
      if (j) y /= 3, y *= 2;
      int tmp = check(x, y);
      if (tmp >= 0 && tmp + i + j < ans) ans = tmp + i + j, ii = i, jj = j;
    }
  }
  if (ans == 0x3f3f3f3f)
    puts("-1");
  else {
    printf("%d\n", ans);
    while (ii--) {
      if (a % 3 == 0)
        a /= 3, a *= 2;
      else if (b % 3 == 0)
        b /= 3, b *= 2;
    }
    while (jj--) {
      if (c % 3 == 0)
        c /= 3, c *= 2;
      else if (d % 3 == 0)
        d /= 3, d *= 2;
    }
    while (a * b != c * d) {
      if (a * b > c * d) {
        if (a % 2 == 0)
          a /= 2;
        else
          b /= 2;
      } else {
        if (c % 2 == 0)
          c /= 2;
        else
          d /= 2;
      }
    }
    cout << a << " " << b << endl << c << " " << d << endl;
  }
}
