#include <bits/stdc++.h>
using namespace std;
int myabs(int x) { return x > 0 ? x : -x; }
int max(int x, int y) { return x > y ? x : y; }
int main() {
  long long a1, b1, a2, b2;
  cin >> a1 >> b1 >> a2 >> b2;
  long long area1 = a1 * b1;
  long long area2 = a2 * b2;
  int factor1[2] = {0};
  int factor2[2] = {0};
  long long tmp = area1;
  while (tmp % 2 == 0) {
    factor1[0]++;
    tmp /= 2;
  }
  while (tmp % 3 == 0) {
    factor1[1]++;
    tmp /= 3;
  }
  long long tmp2 = area2;
  while (tmp2 % 2 == 0) {
    factor2[0]++;
    tmp2 /= 2;
  }
  while (tmp2 % 3 == 0) {
    factor2[1]++;
    tmp2 /= 3;
  }
  if (tmp != tmp2)
    cout << -1 << endl;
  else {
    int ans = 0;
    if (factor1[1] > factor2[1]) {
      int tmp = factor1[1] - factor2[1];
      while (a1 % 3 == 0 && tmp > 0) {
        tmp--;
        a1 /= 3;
        a1 *= 2;
        ans++;
      }
      while (b1 % 3 == 0 && tmp > 0) {
        tmp--;
        b1 /= 3;
        b1 *= 2;
        ans++;
      }
    } else {
      int tmp = factor2[1] - factor1[1];
      while (a2 % 3 == 0 && tmp > 0) {
        tmp--;
        a2 /= 3;
        a2 *= 2;
        ans++;
      }
      while (b2 % 3 == 0 && tmp > 0) {
        tmp--;
        b2 /= 3;
        b2 *= 2;
        ans++;
      }
    }
    area1 = a1 * b1;
    area2 = a2 * b2;
    factor1[0] = factor2[0] = 0;
    while (area1 % 2 == 0) {
      area1 /= 2;
      factor1[0]++;
    }
    while (area2 % 2 == 0) {
      area2 /= 2;
      factor2[0]++;
    }
    if (factor1[0] > factor2[0]) {
      int tmp = factor1[0] - factor2[0];
      while (a1 % 2 == 0 && tmp > 0) {
        a1 /= 2;
        tmp--;
        ans++;
      }
      while (b1 % 2 == 0 && tmp > 0) {
        b1 /= 2;
        tmp--;
        ans++;
      }
    } else {
      int tmp = factor2[0] - factor1[0];
      while (a2 % 2 == 0 && tmp > 0) {
        a2 /= 2;
        tmp--;
        ans++;
      }
      while (b2 % 2 == 0 && tmp > 0) {
        b2 /= 2;
        tmp--;
        ans++;
      }
    }
    cout << ans << endl;
    cout << a1 << " " << b1 << endl;
    cout << a2 << " " << b2 << endl;
  }
}
