#include <bits/stdc++.h>
using namespace std;
#pragma(comment, linker("\STACK:50000000"))
int count(long long a, int d) {
  int ans = 0;
  while (a % d == 0) {
    ans++;
    a /= d;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long a1, b1, a2, b2;
  cin >> a1 >> b1 >> a2 >> b2;
  int c1 = count(a1 * b1, 3), c2 = count(a2 * b2, 3);
  int ans = 0;
  while (c1 > c2) {
    if (a1 % 3 == 0) {
      a1 *= 2;
      a1 /= 3;
      c1--;
      ans++;
    } else {
      b1 *= 2;
      b1 /= 3;
      c1--;
      ans++;
    }
  }
  while (c2 > c1) {
    if (a2 % 3 == 0) {
      a2 *= 2;
      a2 /= 3;
      c2--;
      ans++;
    } else {
      b2 *= 2;
      b2 /= 3;
      c2--;
      ans++;
    }
  }
  c1 = count(a1 * b1, 2), c2 = count(a2 * b2, 2);
  while (c1 > c2) {
    if (a1 % 2 == 0) {
      a1 /= 2;
      c1--;
      ans++;
    } else {
      b1 /= 2;
      c1--;
      ans++;
    }
  }
  while (c2 > c1) {
    if (a2 % 2 == 0) {
      a2 /= 2;
      c2--;
      ans++;
    } else {
      b2 /= 2;
      c2--;
      ans++;
    }
  }
  if (a1 * b1 != a2 * b2) {
    cout << -1;
    return 0;
  } else {
    cout << ans << endl << a1 << ' ' << b1 << endl << a2 << ' ' << b2 << endl;
  }
}
