#include <bits/stdc++.h>
using namespace std;
class PowerNumber {
 public:
  map<int, int> powers;
  PowerNumber(int n) {
    if (n == 1) {
      powers[2] = 0;
      return;
    }
    for (int i = 2; i * i <= n; i++) {
      int cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      if (cnt) powers[i] = cnt;
    }
    if (n > 1) powers[n] = 1;
  }
  PowerNumber operator*(const PowerNumber& other) const {
    PowerNumber result(*this);
    result *= other;
    return result;
  }
  PowerNumber& operator*=(const PowerNumber& other) {
    for (auto it = other.powers.begin(); it != other.powers.end(); it++) {
      this->powers[it->first] += it->second;
    }
    return *this;
  }
  PowerNumber operator/(const PowerNumber& other) const {
    PowerNumber result(*this);
    result /= other;
    return result;
  }
  PowerNumber& operator/=(const PowerNumber& other) {
    for (auto it = other.powers.begin(); it != other.powers.end(); it++) {
      this->powers[it->first] -= it->second;
      if (this->powers[it->first] == 0) {
        this->powers.erase(it->first);
      }
    }
    return *this;
  }
};
void Solve() {
  int i, j, k, n, m;
  int a[2], b[2];
  scanf("%d%d%d%d", &(a[0]), &(a[1]), &(b[0]), &(b[1]));
  PowerNumber pn1(a[0]);
  pn1 *= PowerNumber(a[1]);
  PowerNumber pn2(b[0]);
  pn2 *= PowerNumber(b[1]);
  int d12 = pn1.powers[2];
  int d22 = pn2.powers[2];
  int d13 = pn1.powers[3];
  int d23 = pn2.powers[3];
  pn1.powers[2] = 0;
  pn1.powers[3] = 0;
  pn2.powers[2] = 0;
  pn2.powers[3] = 0;
  if (pn1.powers != pn2.powers) {
    printf("-1");
    return;
  }
  int res = 0;
  while (d23 > d13) {
    res++;
    d23--;
    d22++;
    if (b[0] % 3 == 0) {
      b[0] /= 3;
      b[0] *= 2;
    } else {
      b[1] /= 3;
      b[1] *= 2;
    }
  }
  while (d13 > d23) {
    res++;
    d13--;
    d12++;
    if (a[0] % 3 == 0) {
      a[0] /= 3;
      a[0] *= 2;
    } else {
      a[1] /= 3;
      a[1] *= 2;
    }
  }
  while (d22 > d12) {
    res++;
    d22--;
    if (b[0] % 2 == 0)
      b[0] /= 2;
    else
      b[1] /= 2;
  }
  while (d12 > d22) {
    res++;
    d12--;
    if (a[0] % 2 == 0)
      a[0] /= 2;
    else
      a[1] /= 2;
  }
  printf("%d\n%d %d\n%d %d", res, a[0], a[1], b[0], b[1]);
}
int main() {
  Solve();
  return 0;
}
