#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wformat"
template <typename T>
void printContainer(T& a) {
  auto it = a.begin();
  cout << "{" << *(it++);
  for (; it != a.end(); ++it) cout << ", " << (*it);
  cout << "}\n";
}
map<long long, int> A1, A2;
int sol;
long long solarea;
void dfs1(long long area, int opsSoFar) {
  A1[area] = opsSoFar;
  if (area % 3 == 0) {
    if (!A1.count(area / 3 * 2)) {
      dfs1(area / 3 * 2, opsSoFar + 1);
    }
  }
  if (area % 2 == 0) {
    if (!A1.count(area / 2)) dfs1(area / 2, opsSoFar + 1);
  }
}
void dfs2(long long area, int opsSoFar) {
  A2[area] = opsSoFar;
  if (A1.count(area)) {
    if (opsSoFar + A1[area] < sol) {
      sol = opsSoFar + A1[area];
      solarea = area;
    }
    return;
  }
  if (area % 3 == 0) {
    if (!A2.count(area / 3 * 2)) {
      dfs2(area / 3 * 2, opsSoFar + 1);
    }
  }
  if (area % 2 == 0) {
    if (!A2.count(area / 2)) dfs2(area / 2, opsSoFar + 1);
  }
}
int threeFactors(long long num) {
  int cnt = 0;
  while (num % 3 == 0) num /= 3, cnt++;
  return cnt;
}
int main() {
  long long a1, b1, a2, b2;
  cin >> a1 >> b1 >> a2 >> b2;
  long long S1 = a1 * b1, S2 = a2 * b2;
  dfs1(S1, 0);
  sol = 1e9;
  dfs2(S2, 0);
  if (sol == 1e9) {
    cout << "-1" << endl;
    return 0;
  }
  int T = 0, D = 0;
  cout << sol << endl;
  T = threeFactors(S1) - threeFactors(solarea);
  long long tmp = S1;
  for (int i = 0; i < (int)(T); ++i) tmp = (tmp / 3 * 2);
  while (tmp != solarea) ++D, tmp /= 2;
  while (a1 % 3 == 0 && T > 0) a1 = (a1 / 3 * 2), --T;
  while (b1 % 3 == 0 && T > 0) b1 = (b1 / 3 * 2), --T;
  while (a1 % 2 == 0 && D > 0) a1 = (a1 / 2), --D;
  while (b1 % 2 == 0 && D > 0) b1 = (b1 / 2), --D;
  cout << a1 << " " << b1 << endl;
  T = 0, D = 0;
  T = threeFactors(S2) - threeFactors(solarea);
  tmp = S2;
  for (int i = 0; i < (int)(T); ++i) tmp = (tmp / 3 * 2);
  while (tmp != solarea) ++D, tmp /= 2;
  while (a2 % 3 == 0 && T > 0) a2 = (a2 / 3 * 2), --T;
  while (b2 % 3 == 0 && T > 0) b2 = (b2 / 3 * 2), --T;
  while (a2 % 2 == 0 && D > 0) a2 = (a2 / 2), --D;
  while (b2 % 2 == 0 && D > 0) b2 = (b2 / 2), --D;
  cout << a2 << " " << b2 << endl;
}
