#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long A1, A2, B1, B2;
  cin >> A1 >> B1;
  cin >> A2 >> B2;
  long long S1 = A1 * B1;
  long long S2 = A2 * B2;
  long long a1 = 0, a2 = 0, b1 = 0, b2 = 0;
  long long tmp = S1;
  while (tmp % 2 == 0) {
    tmp /= 2;
    a1++;
  }
  while (tmp % 3 == 0) {
    tmp /= 3;
    b1++;
  }
  long long tmp2 = S2;
  while (tmp2 % 2 == 0) {
    tmp2 /= 2;
    a2++;
  }
  while (tmp2 % 3 == 0) {
    tmp2 /= 3;
    b2++;
  }
  if (tmp != tmp2) {
    cout << -1 << endl;
    return 0;
  }
  long long ans = 0;
  if (b1 > b2) {
    while (b1 != b2) {
      ans++;
      a1++;
      b1--;
      if (B1 % 3 == 0)
        B1 -= B1 / 3;
      else
        A1 -= A1 / 3;
    }
  } else {
    while (b1 != b2) {
      ans++;
      a2++;
      b2--;
      if (B2 % 3 == 0)
        B2 -= B2 / 3;
      else
        A2 -= A2 / 3;
    }
  }
  if (a1 > a2) {
    while (a1 != a2) {
      ans++;
      a1--;
      if (B1 % 2 == 0)
        B1 /= 2;
      else
        A1 /= 2;
    }
  } else {
    while (a1 != a2) {
      ans++;
      a2--;
      if (B2 % 2 == 0)
        B2 -= B2 / 2;
      else
        A2 -= A2 / 2;
    }
  }
  cout << ans << endl;
  cout << A1 << ' ' << B1 << endl;
  cout << A2 << ' ' << B2 << endl;
  return 0;
}
