#include <bits/stdc++.h>
using namespace std;
map<long long, int> mm1, mm2;
struct point {
  long long x, y;
  point() {}
  point(long long _x, long long _y) : x(_x), y(_y) {}
};
map<long long, point> mp1, mp2;
map<long long, int>::iterator iter;
void dfs(long long x, long long y, map<long long, int> &mm,
         map<long long, point> &mp, int t) {
  long long tmp = x * y;
  iter = mm.find(tmp);
  if (iter == mm.end() || iter->second > tmp) {
    mm[tmp] = t;
    mp[tmp] = point(x, y);
  } else
    return;
  if (x % 2 == 0) dfs(x / 2, y, mm, mp, t + 1);
  if (x % 3 == 0) dfs(x / 3 * 2, y, mm, mp, t + 1);
  if (y % 2 == 0) dfs(x, y / 2, mm, mp, t + 1);
  if (y % 3 == 0) dfs(x, y / 3 * 2, mm, mp, t + 1);
}
int main() {
  long long a1, a2, b1, b2;
  while (scanf("%I64d%I64d%I64d%I64d", &a1, &b1, &a2, &b2) == 4) {
    mm1.clear();
    mm2.clear();
    mp1.clear();
    mp2.clear();
    dfs(a1, b1, mm1, mp1, 0);
    dfs(a2, b2, mm2, mp2, 0);
    map<long long, int>::iterator iter;
    int ans = 0x7fffffff;
    point p1, p2;
    for (iter = mm1.begin(); iter != mm1.end(); iter++) {
      long long tmp = iter->first;
      map<long long, int>::iterator iter1 = mm2.find(tmp);
      if (iter1 == mm2.end()) continue;
      if (iter->second + iter1->second < ans) {
        ans = iter->second + iter1->second;
        p1 = mp1[iter->first];
        p2 = mp2[iter1->first];
      }
    }
    if (ans == 0x7fffffff) {
      puts("-1");
      continue;
    }
    printf("%d\n", ans);
    printf("%I64d %I64d\n", p1.x, p1.y);
    printf("%I64d %I64d\n", p2.x, p2.y);
  }
  return 0;
}
