#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, int> > values(int n) {
  vector<pair<long long, int> > ret;
  int cnt3 = 0, cnt2 = 0;
  int nn = n;
  long long number;
  while (nn % 2 == 0) {
    cnt2++;
    nn /= 2;
  }
  while (nn % 3 == 0) {
    cnt3++;
    nn /= 3;
  }
  for (int rem3 = 0; rem3 <= cnt3; rem3++) {
    int tot2 = rem3 + cnt2;
    for (int rem2 = 0; rem2 <= tot2; rem2++) {
      number = (long long)nn;
      for (int i = 0; i < cnt3 - rem3; i++) number *= 3;
      for (int i = 0; i < tot2 - rem2; i++) number *= 2;
      ret.push_back(pair<long long, int>(number, rem2 + rem3));
    }
  }
  return ret;
}
int main() {
  int a1, a2, b1, b2;
  scanf("%d %d", &a1, &b1);
  scanf("%d %d", &a2, &b2);
  vector<pair<long long, int> > v1, v2, v3, v4;
  int ans = 1000000000;
  int a, b, c, d;
  v1 = values(a1);
  v2 = values(b1);
  v3 = values(a2);
  v4 = values(b2);
  sort(v4.begin(), v4.end());
  long long tar;
  int s, e, mid, v;
  for (int i = 0; i < v1.size(); i++) {
    for (int j = 0; j < v2.size(); j++) {
      for (int k = 0; k < v3.size(); k++) {
        if ((v1[i].first * v2[j].first) % v3[k].first == 0) {
          tar = (v1[i].first * v2[j].first) / v3[k].first;
          s = 0, e = v4.size() - 1, v = -1;
          while (s <= e) {
            mid = (s + e) / 2;
            if (v4[mid].first >= tar) {
              e = mid - 1;
              v = mid;
            } else {
              s = mid + 1;
            }
          }
          if (v != -1 && v4[v].first == tar) {
            if (v1[i].second + v2[j].second + v3[k].second + v4[v].second <
                ans) {
              ans = v1[i].second + v2[j].second + v3[k].second + v4[v].second;
              a = v1[i].first, b = v2[j].first, c = v3[k].first,
              d = v4[v].first;
            }
          }
        }
      }
    }
  }
  if (ans == 1000000000) {
    printf("-1\n");
  } else {
    printf("%d\n%d %d\n%d %d\n", ans, a, b, c, d);
  }
}
