Problem: Polycarpus likes giving presents to Paraskevi. He has bought two chocolate bars, each of them has the shape of a segmented rectangle. The first bar is a1 × b1 segments large and the second one is a2 × b2 segments large.

Polycarpus wants to give Paraskevi one of the bars at the lunch break and eat the other one himself. Besides, he wants to show that Polycarpus's mind and Paraskevi's beauty are equally matched, so the two bars must have the same number of squares.

To make the bars have the same number of squares, Polycarpus eats a little piece of chocolate each minute. Each minute he does the following:

  * he either breaks one bar exactly in half (vertically or horizontally) and eats exactly a half of the bar, 
  * or he chips of exactly one third of a bar (vertically or horizontally) and eats exactly a third of the bar. 



In the first case he is left with a half, of the bar and in the second case he is left with two thirds of the bar.

Both variants aren't always possible, and sometimes Polycarpus cannot chip off a half nor a third. For example, if the bar is 16 × 23, then Polycarpus can chip off a half, but not a third. If the bar is 20 × 18, then Polycarpus can chip off both a half and a third. If the bar is 5 × 7, then Polycarpus cannot chip off a half nor a third.

What is the minimum number of minutes Polycarpus needs to make two bars consist of the same number of squares? Find not only the required minimum number of minutes, but also the possible sizes of the bars after the process.

Input

The first line of the input contains integers a1, b1 (1 ≤ a1, b1 ≤ 109) — the initial sizes of the first chocolate bar. The second line of the input contains integers a2, b2 (1 ≤ a2, b2 ≤ 109) — the initial sizes of the second bar.

You can use the data of type int64 (in Pascal), long long (in С++), long (in Java) to process large integers (exceeding 231 - 1).

Output

In the first line print m — the sought minimum number of minutes. In the second and third line print the possible sizes of the bars after they are leveled in m minutes. Print the sizes using the format identical to the input format. Print the sizes (the numbers in the printed pairs) in any order. The second line must correspond to the first bar and the third line must correspond to the second bar. If there are multiple solutions, print any of them.

If there is no solution, print a single line with integer -1.

Examples

Input

2 6
2 3


Output

1
1 6
2 3


Input

36 5
10 16


Output

3
16 5
5 16


Input

3 5
2 1


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const long long INF = (1e9) + 7;
const long double EPS = 1e-8;
int cnt[8];
int main() {
  long long a, b;
  long long a1, b1;
  cin >> a >> b;
  cin >> a1 >> b1;
  long long q, w, e, r;
  q = a;
  w = b;
  e = a1;
  r = b1;
  int cnta1 = 0, cnta2 = 0, cntb1 = 0, cntb2 = 0;
  while (q % 2 == 0) {
    q /= 2;
    cnta1++;
    cnt[0]++;
  }
  while (q % 3 == 0) {
    q /= 3;
    cnta2++;
    cnt[1]++;
  }
  while (w % 2 == 0) {
    w /= 2;
    cnta1++;
    cnt[2]++;
  }
  while (w % 3 == 0) {
    w /= 3;
    cnta2++;
    cnt[3]++;
  }
  while (e % 2 == 0) {
    e /= 2;
    cntb1++;
    cnt[4]++;
  }
  while (e % 3 == 0) {
    e /= 3;
    cntb2++;
    cnt[5]++;
  }
  while (r % 2 == 0) {
    r /= 2;
    cntb1++;
    cnt[6]++;
  }
  while (r % 3 == 0) {
    r /= 3;
    cntb2++;
    cnt[7]++;
  }
  if (q * w != e * r) {
    cout << -1;
    return 0;
  }
  int z = cnta2 - cntb2;
  int po[60];
  for (int i = 0; i < (int)60; i++) po[i] = 1 << i;
  int po3[60];
  po3[0] = 1;
  for (int i = 1; i < 60; i++) po3[i] = po3[i - 1] * 3;
  long long ans = abs(z);
  if (z > 0) {
    cnta1 += z;
    int s = min(z, cnt[1]);
    int h = po[s];
    int g = po3[s];
    a /= g;
    a *= h;
    cnt[0] += s;
    z = z - s;
    s = min(z, cnt[3]);
    h = po[s];
    g = po3[s];
    b /= g;
    b *= h;
    cnt[2] += s;
  } else {
    z = -z;
    cntb1 += z;
    int s = min(z, cnt[5]);
    int h = po[s];
    int g = po3[s];
    a1 /= g;
    a1 *= h;
    z = z - s;
    cnt[4] += s;
    s = min(z, cnt[7]);
    h = po[s];
    g = po3[s];
    b1 /= g;
    b1 *= h;
    cnt[6] += s;
  }
  int y = cnta1 - cntb1;
  ans += abs(y);
  if (y > 0) {
    int s = min(y, cnt[0]);
    int h = po[s];
    a /= h;
    y = y - s;
    s = min(y, cnt[2]);
    h = po[s];
    b /= h;
  } else {
    y = -y;
    int s = min(y, cnt[4]);
    int h = po[s];
    a1 /= h;
    y = y - s;
    s = min(y, cnt[6]);
    h = po[s];
    b1 /= h;
  }
  cout << ans << endl;
  cout << a << " " << b << endl;
  cout << a1 << " " << b1 << endl;
  return 0;
}