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 JAVA):

Solution:
import java.util.*;
import java.io.*;
public class Solution implements Runnable{
    FastScanner sc;
    PrintWriter pw;
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
 
        public long nlo() {
            return Long.parseLong(next());
        }
 
        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }
 
        public int ni() {
            return Integer.parseInt(next());
        }
 
        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }
 
        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public static void main(String[] args) throws Exception
    {
        new Thread(null,new Solution(),"codeforces",1<<28).start();
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
        solve();
        pw.flush();
        pw.close();
    }
    public long gcd(long a,long b)
    {
        return b==0L?a:gcd(b,a%b);
    }
    public long ppow(long a,long b,long mod)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            a%=mod;
            tmp%=mod;
            b>>=1;
        }
        return (tmp*a)%mod;
    }
    public  int gcd(int x,int y)
    {
        return y==0?x:gcd(y,x%y);
    }
    //////////////////////////////////
    /////////////  LOGIC  ///////////
    ////////////////////////////////
    public void solve()
    {
        int t=1;
        while(t-->0)
        {
           long a=sc.nlo();
           long b=sc.nlo();
           long c=sc.nlo();
           long d=sc.nlo();
           long[] arr=new long[2];
           long[] brr=new long[2];
           long X=a*b;
           long Y=c*d;
           long u=0,v=0,x=0,y=0;
           while(X%2L==0)
           {
               arr[0]++;
               X/=2L;
           }
           while(X%3L==0)
           {
               arr[1]++;
               X/=3L;
           }
           while(Y%2L==0)
           {
               brr[0]++;
               Y/=2L;
           }
           while(Y%3L==0)
           {
               brr[1]++;
               Y/=3L;
           }
           if(X!=Y)
           pw.println("-1");
           else
           {
               long ans=0;
               if(arr[1]>brr[1])
                    {
                        y=arr[1]-brr[1];
                        arr[0]+=y;
                        ans+=y;
                        while(y>0&&(a%3L==0))
                        {
                            a/=3L;
                            a*=2L;
                            y--;
                        }
                        while(y>0&&(b%3L==0))
                        {
                            b/=3L;
                            b*=2L;
                            y--;
                        }
                    }
               else
               {
                   v=brr[1]-arr[1];
                   brr[0]+=v;
                   ans+=v;
                   while(v>0&&(c%3L==0))
                        {
                            c/=3L;
                            c*=2L;
                            v--;
                        }
                        while(v>0&&(d%3L==0))
                        {
                            d/=3L;
                            d*=2L;
                            v--;
                        }
                }
               // pw.println(ans+" grg");
                ans+=(Math.abs(arr[0]-brr[0]));
               // pw.println(ans+"mmm");
               if(arr[0]>brr[0])
                    x=arr[0]-brr[0];
               else
               u=brr[0]-arr[0];
               while(a%2L==0&&x>0)
               {
                   a/=2L;
                   x--;
               }
               while(b%2L==0&&x>0)
               {
                   b/=2L;
                   x--;
               }
               while(c%2L==0&&u>0)
               {
                   c/=2L;
                   u--;
               }
               while(d%2L==0&&u>0)
               {
                   d/=2L;
                   u--;
               }
               pw.println(ans+"\n"+a+" "+b+"\n"+c+" "+d);
           }
        }
    }
}