#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a1, a2, b1, b2, two1, two2, three1, three2, x1, x2, y1, y2, i, j,
      ans;
  cin >> a1 >> b1 >> a2 >> b2;
  x1 = a1;
  x2 = a2;
  y1 = b1;
  y2 = b2;
  two1 = 0;
  while (a1 % 2 == 0) {
    a1 = a1 / 2;
    two1++;
  }
  while (b1 % 2 == 0) {
    b1 = b1 / 2;
    two1++;
  }
  two2 = 0;
  while (a2 % 2 == 0) {
    a2 = a2 / 2;
    two2++;
  }
  while (b2 % 2 == 0) {
    b2 = b2 / 2;
    two2++;
  }
  three1 = 0;
  while (a1 % 3 == 0) {
    a1 = a1 / 3;
    three1++;
  }
  while (b1 % 3 == 0) {
    b1 = b1 / 3;
    three1++;
  }
  three2 = 0;
  while (a2 % 3 == 0) {
    a2 = a2 / 3;
    three2++;
  }
  while (b2 % 3 == 0) {
    b2 = b2 / 3;
    three2++;
  }
  if (a1 * b1 != a2 * b2) {
    printf("-1\n");
    return 0;
  }
  ans = 0;
  if (three1 >= three2) {
    long long pre = three1 - three2;
    two1 += pre;
    ans += pre;
    for (i = 0; i < pre; i++) {
      if (x1 % 3 == 0) {
        x1 = (x1 * 2) / 3;
      } else if (y1 % 3 == 0) {
        y1 = (y1 * 2) / 3;
      }
    }
    if (two1 >= two2) {
      pre = two1 - two2;
      ans += pre;
      for (i = 0; i < pre; i++) {
        if (x1 % 2 == 0) {
          x1 = (x1) / 2;
        } else if (y1 % 2 == 0) {
          y1 = (y1) / 2;
        }
      }
    } else {
      pre = two2 - two1;
      ans += pre;
      for (i = 0; i < pre; i++) {
        if (x2 % 2 == 0) {
          x2 = (x2) / 2;
        } else if (y2 % 2 == 0) {
          y2 = (y2) / 2;
        }
      }
    }
  } else {
    long long pre = three2 - three1;
    two2 += pre;
    ans += pre;
    for (i = 0; i < pre; i++) {
      if (x2 % 3 == 0) {
        x2 = (x2 * 2) / 3;
      } else if (y2 % 3 == 0) {
        y2 = (y2 * 2) / 3;
      }
    }
    if (two1 >= two2) {
      pre = two1 - two2;
      ans += pre;
      for (i = 0; i < pre; i++) {
        if (x1 % 2 == 0) {
          x1 = (x1) / 2;
        } else if (y1 % 2 == 0) {
          y1 = (y1) / 2;
        }
      }
    } else {
      pre = two2 - two1;
      ans += pre;
      for (i = 0; i < pre; i++) {
        if (x2 % 2 == 0) {
          x2 = (x2) / 2;
        } else if (y2 % 2 == 0) {
          y2 = (y2) / 2;
        }
      }
    }
  }
  cout << ans << endl;
  cout << x1 << " " << y1 << "\n";
  cout << x2 << " " << y2 << "\n";
  return 0;
}
