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