#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
int main() {
  long long a, b, c, d;
  cin >> a >> b;
  cin >> c >> d;
  long long a2, a3, c2, c3;
  a2 = a3 = c2 = c3 = 0;
  long long tmp = a * b;
  long long tmp2 = c * d;
  while (tmp % 2 == 0 && tmp) {
    tmp /= 2;
    a2++;
  }
  while (tmp % 3 == 0 && tmp) {
    tmp /= 3;
    a3++;
  }
  while (tmp2 % 2 == 0 && tmp2) {
    tmp2 /= 2;
    c2++;
  }
  while (tmp2 % 3 == 0 && tmp2) {
    tmp2 /= 3;
    c3++;
  }
  if (tmp2 != tmp) {
    puts("-1");
    return 0;
  }
  int cnt = 0;
  while (a3 != c3) {
    if (a3 > c3) {
      if (a % 3 == 0 && a) {
        a /= 3;
        a3--;
        a *= 2;
        a2++;
        cnt++;
      } else if (b % 3 == 0 && b) {
        b /= 3;
        a3--;
        b *= 2;
        a2++;
        cnt++;
      }
    }
    if (a3 < c3) {
      if (c % 3 == 0 && c) {
        c /= 3;
        c3--;
        c *= 2;
        c2++;
        cnt++;
      } else if (d % 3 == 0 && d) {
        d /= 3;
        c3--;
        d *= 2;
        c2++;
        cnt++;
      }
    }
  }
  while (a2 != c2) {
    if (a2 < c2) {
      if (c % 2 == 0 && c) {
        c /= 2;
        c2--;
        cnt++;
      } else if (d % 2 == 0 && d) {
        d /= 2;
        c2--;
        cnt++;
      }
    } else if (a2 > c2) {
      if (a % 2 == 0 && a) {
        a /= 2;
        a2--;
        cnt++;
      } else if (b % 2 == 0 && d) {
        b /= 2;
        a2--;
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  cout << a << " " << b << endl;
  cout << c << " " << d << endl;
  return 0;
}
