import java.util.Arrays;
import java.util.Scanner;

public class A {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if (n == 0) {
            System.out.println("YES");
            System.out.println("1");
            System.out.println("1");
            System.out.println("3");
            System.out.println("3");
        } else if (n == 1) {
            int x = in.nextInt();
            System.out.println("YES");
            System.out.println(x);
            System.out.println(x * 3);
            System.out.println(x * 3);
        } else if (n == 2) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a);
            if (a[0] * 3 < a[1]) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
                System.out.println(4 * a[0] - a[1]);
                System.out.println(3 * a[0]);
            }
s
        } else if (n == 3) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a);
            for (int i = 0; i < 2000; i++) {
                for (int j = 0; j < 4; j++) {
                    int[] b = new int[4];
                    boolean flag = false;
                    for (int k = 0; k < 4; k++) {
                        if (k == j) {
                            flag = true;
                            b[k] = i;
                        } else if (flag) {
                            b[k] = a[k - 1];
                        } else {
                            b[k] = a[k];
                        }
                    }
                    if ((b[3] == 3 * b[0]) && (b[2] == (4 * b[0] - b[1]))) {
                        System.out.println("YES");
                        System.out.println(i);
                        in.close();
                        return;
                    }
                }
            }
            System.out.println("NO");
        } else if (n == 4) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a);
            if ((a[3] == 3 * a[0]) && (a[2] == (4 * a[0] - a[1]))) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
        in.close();
    }
}


package codeforces;

/* @@@@@@@@@@@@@@@@@@@@@@@
 * @@@ Doston Akhmedov @@@
 * @@@@@@@@@@@@@@@@@@@@@@@
 */

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class r_278_b {
	static StringTokenizer st;
	static BufferedReader br;
	static PrintWriter pw;

	static class sort implements Comparable<sort> {
		int a, b;

		public sort(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(sort arg0) {
			if (this.a == arg0.a)
				return (this.b - arg0.b);
			return -(this.a - arg0.a);
		}
	}

	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		// gfile();
		int n = nextInt();
		int a[] = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			a[i] = nextInt();
		}
		if (n == 0) {
			pw.println("YES");
			pw.println(1);
			pw.println(1);
			pw.println(3);
			pw.println(3);
			pw.close();
			return;
		}
		int inf = 1000000;
		if (n == 1) {
			if(a[1]*3>=1&&a[1]*3<=inf){
				pw.println("YES");
				pw.println(a[1]);
				pw.println(a[1]);
				pw.println(3*a[1]);
				pw.println(3*a[1]);
				pw.close();
				return;
			}
		}
		if (n == 2) {
			// x1,x2
			boolean ok = false;
			int x1 = a[1], x2 = a[2], x3 = inf, x4 = inf;
			for (int i = 1; i <= inf; i++) {
				if (i == 4 * x1 - x2) {
					x3 = 4 * x1 - x2;
					x4 = 3 * x1;
					ok = true;
					break;
				}
			}
			if (ok) {
				pw.println("YES");
				pw.println(x3);
				pw.println(x4);
				pw.close();
				return;
			}
			// x2,x1
			x2 = a[1];
			x1 = a[2];
			for (int i = 1; i <= inf; i++) {
				if (i == 4 * x1 - x2) {
					x3 = 4 * x1 - x2;
					x4 = 3 * x1;
					ok = true;
					break;
				}
			}
			if (ok) {
				pw.println("YES");
				pw.println(x3);
				pw.println(x4);
				pw.close();
				return;
			}
			// x1,x3
			x1 = a[1];
			x3 = a[2];
			for (int i = 1; i <= inf; i++) {
				if (i == 4 * x1 - x3) {
					x2 = 4 * x1 - x3;
					x4 = 3 * x1;
					ok = true;
					break;
				}
			}
			if (ok) {
				pw.println("YES");
				pw.println(x2);
				pw.println(x4);
				pw.close();
				return;
			}
			// x3,x1
			x3 = a[1];
			x1 = a[2];
			for (int i = 1; i <= inf; i++) {
				if (i == 4 * x1 - x3) {
					x2 = 4 * x1 - x3;
					x4 = 3 * x1;
					ok = true;
					break;
				}
			}
			if (ok) {
				pw.println("YES");
				pw.println(x2);
				pw.println(x4);
				pw.close();
				return;
			}
			// x1,x4;
			x1 = a[1];
			x4 = a[2];
			if (3 * x1 == x4) {
				int p = 4 * x1;
				x2 = p / 2;
				x3 = p - x2;
				ok = true;
			}
			if (ok) {
				pw.println("YES");
				pw.println(x2);
				pw.println(x3);
				pw.close();
				return;
			}
			// x4,x1;
			x4 = a[1];
			x1 = a[2];
			if (3 * x1 == x4) {
				int p = 4 * x1;
				x2 = p / 2;
				x3 = p - x2;
				ok = true;
			}
			if (ok) {
				pw.println("YES");
				pw.println(x2);
				pw.println(x3);
				pw.close();
				return;
			}
			// x2,x3
			x2 = a[1];
			x3 = a[2];
			if ((x2 + x3) % 4 == 0) {
				x1 = (x2 + x3) / 4;
				x4 = 3 * x1;
				ok = true;
			}
			if (ok) {
				pw.println("YES");
				pw.println(x1);
				pw.println(x4);
				pw.close();
				return;
			}
			// x2,x4
			x2 = a[1];
			x4 = a[2];
			if (x4 % 3 == 0) {
				x1 = x4 / 3;
				x3 = 4 * x1 - x2;
				ok = true;
			}
			if (ok) {
				pw.println("YES");
				pw.println(x1);
				pw.println(x3);
				pw.close();
				return;
			}
			// x4,x2
			x4 = a[1];
			x2 = a[2];
			if (x4 % 3 == 0) {
				x1 = x4 / 3;
				x3 = 4 * x1 - x2;
				ok = true;
			}
			if (ok) {
				pw.println("YES");
				pw.println(x1);
				pw.println(x3);
				pw.close();
				return;
			}
			// x3,x4
			x3 = a[1];
			x4 = a[2];
			if (x4 % 3 == 0) {
				x1 = x4 / 3;
				x2 = 4 * x1 - x3;
				ok = true;
			}
			if (ok) {
				pw.println("YES");
				pw.println(x1);
				pw.println(x2);
				pw.close();
				return;
			}
			// x4,x3
			x4 = a[1];
			x3 = a[2];
			if (x4 % 3 == 0) {
				x1 = x4 / 3;
				x2 = 4 * x1 - x3;
				ok = true;
			}
			if (ok) {
				pw.println("YES");
				pw.println(x1);
				pw.println(x2);
				pw.close();
				return;
			}
		}
		if (n == 3) {
			// x4
			Arrays.sort(a, 1, n + 1);
			int x1 = inf, x2 = inf, x3 = inf, x4 = inf;
			if (a[2] + a[3] == 4 * a[1]) {
				x1 = a[1];
				x2 = a[2];
				x3 = a[3];
				x4 = a[1] * 3;
				pw.println("YES");
				pw.println(x4);
				pw.close();
				return;
			}
		}
		if (n == 4) {
			Arrays.sort(a, 1, n + 1);
			if (a[1] * 3 == a[4] && a[2] + a[3] == 4 * a[1]) {
				pw.println("YES");
				pw.close();
				return;
			}
		}
		pw.println("NO");
		pw.close();
	}

	private static void gfile() throws IOException {
		br = new BufferedReader(new FileReader(new File("input.txt")));
		pw = new PrintWriter(new BufferedWriter(new FileWriter(new File(
				"output.txt"))));
	}

	private static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	private static String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
}


import java.util.*;
import java.io.*;

public class Solution {

	public static void main(String[] args) throws Exception {
		Reader.init(System.in);

		int n = Reader.nextInt();

		if (n == 1) {
			int x1 = Reader.nextInt();
			System.out.println("YES");
			System.out.println(x1 + "\n" + 3 * x1 + "\n" + 3 * x1);
		} else if (n == 2) {
			int x1 = Reader.nextInt();
			int x2 = Reader.nextInt();

			int a = 4 * x1 - x2;
			int b = 3 * x1;
			if (x1 <= x2 && x2 <= a && a <= b) {
				System.out.println("YES");
				System.out.println( a + "\n" + b);
			} else {
				System.out.println("NO");
			}
		} else if (n == 3) {
			int x1 = Reader.nextInt();
			int x2 = Reader.nextInt();
			int a = Reader.nextInt();
			int b = x2 + a - x1;

			if ((x1+b)==(b-x1)*2&&x1 <= x2 && x2 <= a && a <= b) {
				System.out.println("YES");
				System.out.println( b);
			} else {
				System.out.println("NO");
			}
		} else {
			int x1 = Reader.nextInt();
			int x2 = Reader.nextInt();
			int a = Reader.nextInt();
			int b = Reader.nextInt();
			if ((x1+b)==(b-x1)*2&&x1 + b == x2 + a && x1 <= x2 && x2 <= a && a <= b) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}

class Reader {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	/** call this method to initialize reader for InputStream */
	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	/** get next word */
	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens()) {
			// TODO add check for eof if necessary
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
}


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(in.readLine());
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = Integer.parseInt(in.readLine());
        }
        Arrays.sort(a);
        if(n==0){
            System.out.println("YES");
            System.out.println(1);
            System.out.println(1);
            System.out.println(3);
            System.out.println(3);
        }
        else if(n==1){
            System.out.println("YES");
            System.out.println(a[0]);
            System.out.println(3*a[0]);
            System.out.println(3*a[0]);
        }
        else if(n==2){
            if(a[1]>3*a[0]) System.out.println("NO");
            else{
                if(a[1]==3*a[0]){
                    System.out.println("YES");
                    System.out.println(a[0]);
                    System.out.println(a[1]);
                }
                else{
                    System.out.println("YES");
                    System.out.println(4*a[0]-a[1]);
                    System.out.println(3*a[0]);
                }
            }
        }
        else if(n==3){
            if(a[3]%3==0&&4*(a[3]/3)==a[1]+a[2]){
                System.out.println("YES");
                System.out.println(a[3]/3);
            }
            else if(a[2]<=3*a[0]){
                if(a[2]==3*a[0]){
                    System.out.println("YES");
                    System.out.println(4*a[0]-a[1]);
                }
                else{
                    if(4*a[0]==a[1]+a[2]){
                        System.out.println("YES");
                        System.out.println(3*a[0]);
                    }
                    else{
                        System.out.println("NO");
                    }
                }
            }
            else{
                System.out.println("NO");
            }
        }
        else{
            if(a[3]==3*a[0]&&a[3]+a[0]==a[1]+a[2]){
                System.out.println("YES");
            }
            else{
                System.out.println("NO");
            }
        }
    }
}


import java.util.*;
public class ColorfulStones {
	public static void main(String args[]){
		Scanner s=new Scanner(System.in);
		String a=s.next();
		String t=s.next();
		int i=0,j=0,r=0;
		r=t.length();
		while(r--){
			if(a.charAt(i)==t.charAt(j))
				i++;
		}
		System.out.println(i+1);
	}

}


public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
	Scanner sc = new Scanner(System.in);
	String S = sc.nextLine();
	String T = sc.nextLine();
	int counter = 1;
	int j =0;
	for(int i=0; i < T.length();i++){
	if(S.charAt(j) == T.charAt(i)){
		counter+=1;
		j++;
	}
	}
	System.out.println(counter);
	}
}


       import java.util.*;
        import java.lang.*;
        public class night
        {
            public static void main(String args[])
            {
    Scanner sc= new Scanner(System.in);
    String s=sc.nextLine();
    String t=sc.nextLine();

    for(int j=0,i=0;i<s.length()||j<t.length();)
    {
    if(s.charAt(i)==t.charAt(j))
    {
    i++;
    j++;
    }
    else if(j<t.length()-1)
    {
    j++;
    }

    }
    System.out.println(i+1);

    }

        }


import java.util.*;
import java.io.*;
//265A
public class bebo {
     static Formatter x;
     static Formatter y ;
     static Scanner l ;
    public static void main(String[] args) {

    try{
        l=new Scanner(new File("input.txt "));
    }catch (Exception e){
        System.out.println("-1");
    }

    String n = "";
    String j="";
    int [] arrayop =new int [21];
    boolean k=true;
     while(l.hasNext())
     {
         if(k==true)
         {
          n =l.nextLine();
         k=false;
         }else
         {
            j = l.nextLine();
         }
     }
       try
       {
        y=new Formatter("output.txt");
        }
       catch(Exception e)
        {
        System.out.println("error")
        }
       int i=0;
     for(int p=0;p<j.length();p++)
     {
        if(j.charAt(p)==n.charAt(i))
        {
        i++;
        }
     }

     y.format("%s",i+1);

        y.close();

    }

}


import java.util.*;

public class Main {
    public static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();

        System.out.println("0" + "0" + n);
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.function.IntBinaryOperator;
import java.util.function.LongFunction;

 public class GFG {
	static long printnumber(long n, long temp, long number) {
		for (long i = 1; i <= temp; ++i) {
			number += 2;
		}
		return number;
	}
static int gcd(int a,int b){
	if(b==0){
		return a;
	}
	return gcd(b,a%b);
}
static long A[]=new long[10001];
static long fib(int n){
	if(n==0){
		return 0;
	}
	if(n==1)
	return 1;
	  if(A[n]!=0){
      return A[n];
	  }
	A[n]=fib(n-1)+fib(n-2);
	return A[n];
}
static boolean check(int t){
	int p=5*t*t+4;
	int s=5*t*t-4;
	double m=Math.sqrt(p);
	double mm=Math.sqrt(s);
	if(m-Math.floor(m)==0||mm-Math.floor(mm)==0){
		return true;
	}
	return false;
}
	public static void main(String[] args) throws IOException {
	Scanner scan=new Scanner(System.in);
	int n=scan.nextInt();
  System.out.print(0+" "+0+" "+n);

}


import java.util.*;
import java.io.*;
import java.math.*;

public class prob37 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new prob37().solve(in,out);
        in.close();
        out.close();
    }

    private void solve(Scanner in, PrintWriter out) {
        int num = in.nextInt();
        int[] fibs = new int[41];
        fibs[0] = 0;
        fibs[1] = 1;
        boolean ans = false;
        outer: for(int i=0; i<41; i++) {
            for(int j=0; j<41; j++) {
                for(int k=0; k<41; k++) {
                    if(fibs[i]+fibs[j]+fib[k]==num) {
                        out.println(fibs[i] + " " + fibs[j] + " " + fibs[k]);
                        ans=true;
                        break outer;
                    }
                }
            }
        }
        if(!ans) out.println("I'm too stupid to solve this problem");
    }
}


import java.util.*;

public class cf {
    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();

        System.out.println("0 0 " + n);

        }
    }
}


\
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class A {

    static BufferedReader in;
    static StringTokenizer st;
    static PrintWriter out;

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                System.out)));
        String s = next();
        Map<String, Integer> num = new HashMap<String, Integer>();
        for (int i = 1; i <= 10; i++) {
            num.put(next(), i - 1);
        }
        for (int i = 0; i < s.length(); i += 10) {
            out.print(num.get(s.substring(i, i + 10)));
        }
        out.close();
    }

}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package codeforces;

import java.util.Scanner;

/**
 *
 * @author Familia
 */
public class Main
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    Scanner in=new Scanner(System.in);
   int cont[]=new int[10];
      String bin[]=new String[10];
      String cb=in.next();
       for(int i=0;i<10;i++)
          bin[i]=in.next();
    int a=0,b=10;
      while(b<=80)
     {
       for(int j=0;j<10;j++)
           if(cb.substring(a, b).equals(bin[j]))
           {

               System.out.print(j);
             break;
           }
       a=a+10;b=b+10;
           }

        }

    }

}


import java.io.*;
public class pass1
{
public static void main(String args[])throws IOException
{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
String pass=br.readLine();
String s1,a[]=new int[10],out="";
for(i=0;i<10;i++)
a[i]=br.readLine();
for(i=0;i<80;i+=10)
{
s1=pass.substring(i,i+10);
for(j=0;j<10;j++)
{
if(s1.equals(a[j])==true)
{out=out+Integer.toString(j);
break;}}
}
System.out.println(out);
}}


import java.util.Scanner;

public class restorePassword {

	public static void main(String[] args) {
		Scanner input = new Scanner (System.in);

		String seenBinarys = input.nextLine();
		String [] orderBinarysArr = new String [10];
		String [] seenBinarysArr = new String [8];
		for (int i = 0 ; i <10;i++){
			orderBinarysArr[i] =input.nextLine();
		}

		for (int i = 0 , j = 10,counter=0;counter<8;i+=10,j+=10,counter++){
			seenBinarysArr[counter] = seenBinarys.substring(i,j);
		}

		for (int i = 0 ; i<8;i++){
			for(int j = 0 ; j<10;j++){
				if (seenBinarysArr[i].equals(orderBinarysArr[j])){
					System.out.print(j);
				}
			}
		}

	}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author phantom11
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        boolean possible;
        int K;
        long stepsPossible = new long[100];

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long x = in.nextInt(), y = in.nextInt();
            long steps[] = new long[100];
            steps[0] = x;

            recur(x, y, steps, 1);
            if (possible) {
                out.printLine("YES");
                out.printLine(K);
                for (int i = 0; i < K; i++) {
                    out.print(stepsPossible[i] + " ");
                }
            } else {
                out.printLine("NO");
            }
        }

        public void recur(long x, long y, long steps[], int k) {
            if (x == y) {
                possible = true;
                for (int i = 0; i < steps.length; i++) {
                    stepsPossible[i] = steps[i];
                }
                K = k;
                return;
            }
            if (x > y || possible) return;
            steps[k] = 2 * x;
            recur(2 * x, y, steps, k + 1);
            steps[k] = 10 * x + 1;
            recur(10 * x + 1, y, steps, k + 1);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main{
  public static void main(String[] args) {
    Scanner in=new Scanner(System.in);
    long a=in.nextLong();
    long b=in.nextLong();
    ArrayList<Long> arr=new ArrayList<>();
    arr.add(b);
    while(a<b){
      if(b%2==1){
        b=(b-1)/10;
      }
      else{
        b/=2;
      }
      arr.add(b);
    }
    if(a==b){
      System.out.println("YES");
      Collections.reverse(arr);
      System.out.println(arr.size());
      for(int a1:arr){
        System.out.print(a1+" ");
      }
    }
    else{
      System.out.println("NO");
    }
  }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author phantom11
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        boolean possible;
        int K;
        long stepsPossible = new long[100];

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long x = in.nextInt(), y = in.nextInt();
            long steps[] = new long[100];
            steps[0] = x;
            recur(x, y, steps, 1);
            if (possible) {
                out.printLine("YES");
                out.printLine(K);
                for (int i = 0; i < K; i++) {
                    out.print(stepsPossible[i] + " ");
                }
            } else {
                out.printLine("NO");
            }
        }

        public void recur(long x, long y, long steps[], int k) {
            if (x == y) {
                possible = true;
                for (int i = 0; i < steps.length; i++) {
                    stepsPossible[i] = steps[i];
                }
                K = k;
                return;
            }
            if (x > y || possible) return;
            steps[k] = 2 * x;
            recur(2 * x, y, steps, k + 1);
            steps[k] = 10 * x + 1;
            recur(10 * x + 1, y, steps, k + 1);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


public class transformation { //Превращение: из А в Б 727А
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int num1 = scan.nextInt();
        int num2 = scan.nextInt(),k=num2;
        ArrayList<Integer> arr = new ArrayList<>();
        while(num2>num1){
            if(num2%2==0){
                num2=num2/2;
                arr.add(num2);
            }
            else if(num2%10==1){
                num2=num2/10;
                arr.add(num2);
            }
            else
                break;
        }
        if(num1==num2){
            System.out.println("YES");
            System.out.println(arr.size()+1);
            for(int i=arr.size()-1;i>=0;i--){
                System.out.print(arr.get(i)+" ");
            }
            System.out.print(k);
        }
        else
            System.out.println("NO");
    }
}


import java.util.Scanner;

public class Monitors {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        int x = s.nextInt();
        int y = s.nextInt();
        int resX = count(a, b, x, y, 0, a - (a % x));
        int resY = resX / x * y;
        System.out.println(resX + " " + resY);
    }

    static int count(int a, int b, int x, int y, int l, int r) {
        if (r == 0) {
            return 0;
        } else if (l > r) {
            return 0;
        } else {
            int mid = (l + r) / 2;
            mid -= mid % x;
            mid += x;
            int p = mid / x * y;
            if (p > b) {
                return count(a, b, x, y, l, mid);
            } else {
                return Math.max(mid, count(a, b, x, y, mid + 1, r));
            }
        }
    }

}


import java.math.BigInteger;
import java.util.Scanner;

public class C {
	public static void main(String[] args) throws Exception {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		int g = gcd(x,y);
		x /= g;
		y /= g;
		int min = Math.min(n/x, m/y);
		System.out.println(x*min + " " + y*min);
	}
	static int gcd(int a, int b) {
		int l, s, t;
		for (l = Math.max(a, b), s = Math.min(a, b); s > 0;) {
			t = l % s;
			s = l;
			l = t;
		}
		return l;
	}
}


package first;//提交代码时，此行要注释掉
import java.math.BigDecimal;//小数
import java.math.BigInteger;//整数
import java.util.*;
public class Main{
	static int N =1010;
	public static void main(String args[]) {
		Scanner cin = new Scanner(System.in);
		long x,y,a,b,k,z;
		a = cin.nextLong();
		b = cin.nextLong();
		x = cin.nextLong();
		y = cin.nextLong();
		z =Gcd(x,y);
		k =Math.min(a/x,b/y);
		if(x >a |y>b)
			System.out.println(0+" "+0);
		else
			System.out.println(x*k+" "+y*k);
	}
	public static long Gcd(long a,long b) {
		if(b==0)
			return a;
		else
			return Gcd(b,a%b);
	}
}


// package Practice;

import java.util.Scanner;

import static Practice.CF013A.gcd;

public class CF016C {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long b = s.nextLong();
        long x = s.nextLong();
        long y = s.nextLong();
        long gcd = gcd(x,y);

        x /= gcd;
        y /= gcd;
        a /= x;
        b /= y;

        long min = Math.min(a,b);
        a = min * x;
        b = min * y;
        if(a == 0 || b == 0){
            System.out.println("0 0");
        }else{
            System.out.println(a + " " + b);
        }
    }

    private static long gcd(long a, long b) {
        if(b == 0) return a;
        return gcd(b, a%b);
    }
}


import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;

static void solve(){
 char[][] map=ir.nextCharMap(8,8);
 int a;
 int b;
 outer:
 for(int i=0;i<8;i++){
  for(int j=0;j<8;j++){
   if(map[i][j]=='W'){
    a=i;
    break outer;
   }
  }
 }
 out;
 for(int i=0;i<8;i++){
  for(int j=0;j<8;j++){
   if(map[7-i][j]=='W'){
    b=i;
    break out;
   }
  }
 }
 out.println(a<(7-b)?"A":"B");
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}

 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}

 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}

 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}

 public boolean hasNext(){skip(); return hasNextByte();}

 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }

 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public BigInteger nextBigInteger(){return new BigInteger(next());}

 public BigDecimal nextBigDecimal(){return new BigDecimal(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}


import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;

static void solve(){
 char[][] map=ir.nextCharMap(8,8);
 int a;
 int b;
 outer:
 for(int i=0;i<8;i++){
  for(int j=0;j<8;j++){
   if(map[i][j]=='W'){
    a=i;
    break outer;
   }
  }
 }
 out:
 for(int i=0;i<8;i++){
  for(int j=0;j<8;j++){
   if(map[7-i][j]=='W'){
    b=i;
    break out;
   }
  }
 }
 out.println(a<(7-b)?"A":"B");
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}

 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}

 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}

 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}

 public boolean hasNext(){skip(); return hasNextByte();}

 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }

 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public BigInteger nextBigInteger(){return new BigInteger(next());}

 public BigDecimal nextBigDecimal(){return new BigDecimal(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}


import java.util.Scanner;

// 110 problems x 25
// 10
public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = 8;
		String[] word = new String[n];
		for (int i = 0; i < n; i++)
			word[i] = in.nextLine();
		in.close();

		int cA = 7;
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (word[i].charAt(j) == 'W') {
					int ca = 0;
					boolean blocked = false;
					for (int k = i - 1; k >= 0; k--) {
						if (word[k].charAt(j) == 'B') {
							blocked = true;
							break;
						}
						ca++;
					}

					if (blocked) {
//						System.out.println("BLOCK W" + i);
						continue;
					}

					if (ca < cA) cA = ca;
//					System.out.println(ca);
				}
			}
		}

		int cB = 7;
		for (int i = 0; i < n-1; i++) {
			for (int j = 0; j < n; j++) {
				if (word[i].charAt(j) == 'B') {
					int cb = 0;
					boolean blocked = false;
					for (int k = i + 1; k < n; k++) {
						if (word[k].charAt(j) == 'W') {
							blocked = true;
							break;
						}
						cb++;
					}

					if (blocked) {
//						System.out.println("BLOCK B" + i);
						continue;
					}

					if (cb < cB) cB = cb;
//					System.out.println(cb);
				}
			}
		}

//		System.out.println("A " + cA + ";" + " B " + cB);
		System.out.println(cA =< cB ? "A" : "B");

	}
/*
........
........
.B....B.
....W...
........
..W.....
........
........

 *

..B.....
..W.....
......B.
........
.....W..
......B.
........
........
 */
	static int gcd(int p, int q) {
		if (q == 0)
			return p;
		else
			return gcd(q, p % q);
	}

}


package G
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class PawnChess {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader (new InputStreamReader(System.in));

//      Scanner sc = new Scanner(System.in);

        // ArrayList<position> A = new ArrayList<position>();
        // ArrayList<position> B = new ArrayList<position>();

        int white = 0;
        int black = 0;
        // 1 -> W
        // 2 -> B
        // 0 -> .

        int grid[][] = new int[8][8];

        int minA = Integer.MAX_VALUE;
        int minB = Integer.MIN_VALUE;

        for (int r = 0; r < 8; r++) {
            String row = br.readLine();
            for (int c = 0; c < 8; c++) {
                if (row.charAt(c) == 'W')
                    grid[r][c] = 1;
                    if (row.charAt(c) == 'B')
                        grid[r][c] = 2;

            }
        }

        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (grid[i][j] == 1) {
                    boolean ok = true;
                    for (int j2 = i-1; j2 >= 0; j2--) {
                        if (grid[j2][j] == 2 || grid[j2][j] == 1) {
                            ok = false;
                            break;
                        }
                    }
                    if (ok)
                        minA = Math.min(minA, i);
                }
                if (grid[i][j] == 2) {

                    boolean ok = true;
                    for (int j2 = i+1; j2 < 8; j2++) {
                        if (grid[j2][j] == 1 || grid[j2][j] == 2) {
                            ok = false;
                            break;
                        }
                    }
                    if (ok)
                        minB = Math.max(minB, i);

                }
            }
        }
        System.out.println(minA + " " + minB);
        if (minA <= (7-minB))
            System.out.println("A");
        else
            System.out.println("B");

    }
}


import java.io.*;
import java.util.*;
/*
 * 	Heart beats fast
 * 		Colors and promises
 * 			How to be brave
 * 				How can I love when I am afraid to fall...
 */
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
public class Main
{
	public static void main(String[] args)
	{
		double a=ni(),b=ni(),m=ni();
		double x=ni(),y=ni(),z=ni();
		double time=-m/y;
		double time1=time+a/(2*x),time2=time;
		while(time1>=(2*a)/x)
			time1-=(2*a)/x;
		while(time2>=(2*b)/z)
			time2-=(2*b)/z;
		double fa=time1*x;
		double fb=time2*z;
		if(fa>=a)
			fa=2*a-fa;
		if(fb>=b)
			fb=2*b-fb;
		pr(fa+" "+fb);
		System.out.print(output);
	}

	///////////////////////////////////////////
	///////////////////////////////////////////
	///template from here
	static interface combiner
	{
		public int combine(int a, int b);
	}
	static final int mod=1000000007;
	static final double eps=1e-8;
	static final long inf=100000000000000000L;
	static Reader in=new Reader();
	static StringBuilder output=new StringBuilder();
	static Random rn=new Random();
	public static void sort(int[]a)
	{
		int te;
		for(int i=0; i<a.length; i++)
		{
			te=rn.nextInt(a.length);
			if(i!=te)
			{
				a[i]^=a[te];
				a[te]^=a[i];
				a[i]^=a[te];
			}
		}
		Arrays.sort(a);
	}
	public static void sort(long[]a)
	{
		int te;
		for(int i=0; i<a.length; i++)
		{
			te=rn.nextInt(a.length);
			if(i!=te)
			{
			a[i]^=a[te];
			a[te]^=a[i];
			a[i]^=a[te];
			}
		}
		Arrays.sort(a);
	}public static void sort(double[]a)
	{
		int te;
		double te1;
		for(int i=0; i<a.length; i++)
		{
			te=rn.nextInt(a.length);
			if(i!=te)
			{
			te1=a[te];
			a[te]=a[i];
			a[i]=te1;
			}
		}
		Arrays.sort(a);
	}
	public static void sort(int[][]a)
	{
		Arrays.sort(a, new Comparator<int[]>()
		{
			public int compare(int[]a,int[]b)
			{
				if(a[0]>b[0])
					return 1;
				if(b[0]>a[0])
					return -1;
				return 0;
			}
		});
	}
	static int lowerbound(int[]a, int key)
	{
		/*
		 * returns index of smallest element larger than equal to given element between indices l and r inclusive
		 */
		int low=0,high=a.length-1,mid=(low+high)/2;
		while(low<high)
		{
			if(a[mid] >= key)
				high=mid;
			else
				low=mid+1;
			mid=(low+high)/2;
		}
		return mid;
	}
	static int upperbound(int[]a, int key)
	{
		/*
		 * returns index of largest element smaller than equal to given element
		 */
		int low=0,high=a.length-1,mid=(low+high+1)/2;
		while(low<high)
		{
			if(a[mid] <= key)
				low=mid;
			else
				high=mid-1;
			mid=(low+high+1)/2;
		}
		return mid;
	}
	static int lowerbound(int[]a, int l, int r, int key)
	{
		/*
		 * returns index of smallest element larger than equal to given element between indices l and r inclusive
		 */
		int low=l,high=r,mid=(low+high)/2;
		while(low<high)
		{
			if(a[mid] >= key)
				high=mid;
			else
				low=mid+1;
			mid=(low+high)/2;
		}
		return mid;
	}
	static int upperbound(int[]a, int l, int r, int key)
	{
		/*
		 * returns index of largest element smaller than equal to given element
		 */
		int low=l,high=r,mid=(low+high+1)/2;
		while(low<high)
		{
			if(a[mid] <= key)
				low=mid;
			else
				high=mid-1;
			mid=(low+high+1)/2;
		}
		return mid;
	}
	static class pair
	{
		int a,b;
		pair()
		{

		}
		pair(int c,int d)
		{
			a=c;
			b=d;
		}
	}
	void sort(pair[]a)
	{
		Arrays.sort(a,new Comparator<pair>()
				{
			@Override
			public int compare(pair a,pair b)
			{
				if(a.a>b.a)
					return 1;
				if(b.a>a.a)
				return -1;
				return 0;
			}
				});
	}
	static int log2n(long a)
	{
		int te=0;
		while(a>0)
		{
			a>>=1;
			++te;
		}
		return te;
	}
	static class iter
	{
		vecti a;
		int zin=0;
		iter(vecti b)
		{
			a=b;
		}
		public boolean hasNext()
		{
			if(a.size>zin)
				return true;
			return false;
		}
		public int next()
		{
			return a.a[zin++];
		}
		public void previous()
		{
			zin--;
		}
	}
	static class vecti
	{
		int a[],size;
		vecti()
		{
			a=new int[10];
			size=0;
		}
		vecti(int n)
		{
			a=new int[n];
			size=0;
		}
		public void add(int b)
		{
			if(++size==a.length)
				a=Arrays.copyOf(a, 2*size);
			a[size-1]=b;
		}
		public void sort()
		{
			Arrays.sort(a, 0, size);
		}
		public void sort(int l, int r)
		{
			Arrays.sort(a, l, r);
		}
		public iter iterator()
		{
			return new iter(this);
		}
	}
	static class lter
	{
		vectl a;
		int curi=0;
		lter(vectl b)
		{
			a=b;
		}
		public boolean hasNext()
		{
			if(a.size>curi)
				return true;
			return false;
		}
		public long next()
		{
			return a.a[curi++];
		}
		public long prev()
		{
			return a.a[--curi];
		}
	}
	static class vectl
	{
		long a[];
		int size;
		vectl()
		{
			a=new long[10];
			size=0;
		}
		vectl(int n)
		{
			a=new long[n];
			size=0;
		}
		public void add(long b)
		{
			if(++size==a.length)
				a=Arrays.copyOf(a, 2*size);
			a[size-1]=b;
		}
		public void sort()
		{
			Arrays.sort(a, 0, size);
		}
		public void sort(int l, int r)
		{
			Arrays.sort(a, l, r);
		}
		public lter iterator()
		{
			return new lter(this);
		}
	}
	static class dter
	{
		vectd a;
		int curi=0;
		dter(vectd b)
		{
			a=b;
		}
		public boolean hasNext()
		{
			if(a.size>curi)
				return true;
			return false;
		}
		public double next()
		{
			return a.a[curi++];
		}
		public double prev()
		{
			return a.a[--curi];
		}
	}
	static class vectd
	{
		double a[];
		int size;
		vectd()
		{
			a=new double[10];
			size=0;
		}
		vectd(int n)
		{
			a=new double[n];
			size=0;
		}
		public void add(double b)
		{
			if(++size==a.length)
				a=Arrays.copyOf(a, 2*size);
			a[size-1]=b;
		}
		public void sort()
		{
			Arrays.sort(a, 0, size);
		}
		public void sort(int l, int r)
		{
			Arrays.sort(a, l, r);
		}
		public dter iterator()
		{
			return new dter(this);
		}
	}
	//output functions////////////////
	static void pr(Object a){output.append(a+"\n");}
	static void pr(){output.append("\n");}
	static void p(Object a){output.append(a);}
	static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");}
	static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");}
	static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");}
	static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");}
	static void sop(Object a){System.out.println(a);}
	static void flush(){System.out.println(output);output=new StringBuilder();}
	//////////////////////////////////
	//input functions/////////////////
	static int ni(){return in.nextInt();}
	static long nl(){return Long.parseLong(in.next());}
	static String ns(){return in.next();}
	static double nd(){return Double.parseDouble(in.next());}
	static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;}
	static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;}
	static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;}
	static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;}
	static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;}
	static vecti niv(int n) {vecti a=new vecti(n);a.size=n;for(int i=0; i<n; i++)a.a[i]=ni();return a;}
	static vectl nlv(int n) {vectl a=new vectl(n);a.size=n;for(int i=0; i<n; i++)a.a[i]=nl();return a;}
	static vectd ndv(int n) {vectd a=new vectd(n);a.size=n;for(int i=0; i<n; i++)a.a[i]=nd();return a;}
	//////////////////////////////////
	//some utility functions
	static void exit(){System.exit(0);}
	static void psort(int[][] a)
	{
		Arrays.sort(a, new Comparator<int[]>()
		{
			@Override
			public int compare(int[]a,int[]b)
			{
				if(a[0]>b[0])
					return 1;
				else if(b[0]>a[0])
					return -1;
				return 0;
			}
		});
	}
	static String pr(String a, long b)
	{
		String c="";
		while(b>0)
		{
			if(b%2==1)
				c=c.concat(a);
			a=a.concat(a);
			b>>=1;
		}
		return c;
	}
	static long powm(long a, long b, long m)
	{
		long an=1;
		long c=a;
		while(b>0)
		{
			if(b%2==1)
				an=(an*c)%m;
			c=(c*c)%m;
			b>>=1;
		}
		return an;
	}
	static int gcd(int a, int b)
	{
		if(b==0)
			return a;
		else
			return gcd(b, a%b);
	}
	static class Reader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public Reader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
        	return Long.parseLong(next());
        }
        public double nextDouble() {
        	return Double.parseDouble(next());
        }
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;

public class Codeforces_Div2_D implements Runnable{

	private void solve() throws IOException {
		int a = scanner.nextInt(); //100
		int b = scanner.nextInt();
		int m = scanner.nextInt();
		double vx = scanner.nextInt(); //100
		double vy = scanner.nextInt();
		double vz = scanner.nextInt();
		double timeMaxY = Math.abs(m/vy);
		double cx = a/2.0;
		double cy = m;
		double cz = 0;
		cx = emulate(cx,vx,0,a, timeMaxY);
		cz = emulate(cz,vz,0,b, timeMaxY);
		out.println(cx +" " + cz);
	}

	private double emulate(double cx, double vx, double left, double right, double remTimeX) {
		double[] targets = {left, right};
		double timeCycleX = 2.0 * (right - left) / vx;
		double EPS = 1e-9;
		if (Math.abs(timeCycleX) > EPS){
			while (remTimeX > timeCycleX){
				remTimeX -= timeCycleX;
			}
			int iTarget;
			if (vx > 0){
				iTarget = 1;
			}else{
				iTarget = 0;
			}

			while (remTimeX > EPS){
				double distBeforeWall = Math.abs(targets[iTarget] - cx);
				double timeNeeded = Math.abs(distBeforeWall / vx);
				if (remTimeX > timeNeeded + EPS){
					remTimeX -= timeNeeded;
					vx = -vx;
					cx = targets[iTarget];
					iTarget = 1-iTarget;
				}else{
					cx += vx * remTimeX;
					remTimeX = 0;
				}
			}
		}
		return cx;
	}

	/////////////////////////////////////////////////
	final int BUF_SIZE = 1024 * 1024 * 8;//important to read long-string tokens properly
	final int INPUT_BUFFER_SIZE = 1024 * 1024 * 8 ;
	final int BUF_SIZE_INPUT = 1024;

	final int BUF_SIZE_OUT = 1024;

	boolean inputFromFile = false;
	String filenamePrefix = "A-small-attempt0";
	String inSuffix = ".in";
	String outSuffix = ".out";

	//InputStream bis;
	//OutputStream bos;
	PrintStream out;
	ByteScanner scanner;
	ByteWriter writer;

	@Override
	public void run() {
		try{
			InputStream bis = null;
			OutputStream bos = null;
			//PrintStream out = null;
			if (inputFromFile){
				File baseFile = new File(getClass().getResource("/").getFile());
				bis = new BufferedInputStream(
						new FileInputStream(new File(
								baseFile, filenamePrefix+inSuffix)),
								INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(
						new FileOutputStream(
								new File(baseFile, filenamePrefix+outSuffix)));
				out = new PrintStream(bos);
			}else{
				bis = new BufferedInputStream(System.in, INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(System.out);
				out = new PrintStream(bos);
			}
			scanner = new ByteScanner(bis, BUF_SIZE_INPUT, BUF_SIZE);
			writer = new ByteWriter(bos, BUF_SIZE_OUT);

			solve();
			out.flush();
		}catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public interface Constants{
		final static byte ZERO = '0';//48 or 0x30
		final static byte NINE = '9';
		final static byte SPACEBAR = ' '; //32 or 0x20
		final static byte MINUS = '-'; //45 or 0x2d

		final static char FLOAT_POINT = '.';
	}

	public static class EofException extends IOException{
	}

	public static class ByteWriter implements Constants {

		int bufSize = 1024;
		byte[] byteBuf = new byte[bufSize];
		OutputStream os;

		public ByteWriter(OutputStream os, int bufSize){
			this.os = os;
			this.bufSize = bufSize;
		}

		public void writeInt(int num) throws IOException{
	         int byteWriteOffset = byteBuf.length;
	         if (num==0){
	        	 byteBuf[--byteWriteOffset] = ZERO;
	         }else{
	        	 int numAbs = Math.abs(num);
	        	 while (numAbs>0){
	        		 byteBuf[--byteWriteOffset] = (byte)((numAbs % 10) + ZERO);
	        		 numAbs /= 10;
	        	 }
	        	 if (num<0)
	        		 byteBuf[--byteWriteOffset] = MINUS;
	         }
	         os.write(byteBuf, byteWriteOffset, byteBuf.length - byteWriteOffset);
		}

		/**
		 * Please ensure ar.length <= byteBuf.length!
		 *
		 * @param ar
		 * @throws IOException
		 */
		public void writeByteAr(byte[] ar) throws IOException{
			for (int i = 0; i < ar.length; i++) {
				byteBuf[i] = ar[i];
			}
			os.write(byteBuf,0,ar.length);
		}

		public void writeSpaceBar() throws IOException{
			byteBuf[0] = SPACEBAR;
			os.write(byteBuf,0,1);
		}

	}

	public static class ByteScanner implements Constants{

		InputStream is;

		public ByteScanner(InputStream is, int bufSizeInput, int bufSize){
			this.is = is;
			this.bufSizeInput = bufSizeInput;
			this.bufSize = bufSize;

			byteBufInput = new byte[this.bufSizeInput];
			byteBuf = new byte[this.bufSize];
		}

		public ByteScanner(byte[] data){
			byteBufInput = data;
			bufSizeInput = data.length;
			bufSize = data.length;
			byteBuf = new byte[bufSize];
			byteRead = data.length;
			bytePos = 0;
		}

		private int bufSizeInput;
		private int bufSize;

		byte[] byteBufInput;
		byte by=-1;
		int byteRead=-1;
		int bytePos=-1;

		byte[] byteBuf;
		int totalBytes;

		boolean eofMet = false;

		private byte nextByte() throws IOException{

			if (bytePos<0 || bytePos>=byteRead){
				byteRead = is==null? -1: is.read(byteBufInput);
				bytePos=0;
				if (byteRead<0){
					byteBufInput[bytePos]=-1;//!!!
					if (eofMet)
						throw new EofException();
					eofMet = true;
				}
			}
			return byteBufInput[bytePos++];
		}

		/**
		 * Returns next meaningful character as a byte.

		 *
		 * @return
		 * @throws IOException
		 */
		public byte nextChar() throws IOException{
			while ((by=nextByte())<=0x20);
			return by;
		}

		/**
		 * Returns next meaningful character OR space as a byte.

		 *
		 * @return
		 * @throws IOException
		 */
		public byte nextCharOrSpacebar() throws IOException{
			while ((by=nextByte())<0x20);
			return by;
		}

	    /**
	     * Reads line.
	     *
	     * @return
	     * @throws IOException
	     */
	    public String nextLine() throws IOException {
            readToken((byte)0x20);
            return new String(byteBuf,0,totalBytes);
	    }

	    public byte[] nextLineAsArray() throws IOException {
            readToken((byte)0x20);
            byte[] out = new byte[totalBytes];
            System.arraycopy(byteBuf, 0, out, 0, totalBytes);
            return out;
	    }

	    /**
	     * Reads token. Spacebar is separator char.
	     *
	     * @return
	     * @throws IOException
	     */
	    public String nextToken() throws IOException {
            readToken((byte)0x21);
            return new String(byteBuf,0,totalBytes);
	    }

	    /**
	     * Spacebar is included as separator char
	     *
	     * @throws IOException
	     */
	    private void readToken() throws IOException {
            readToken((byte)0x21);
	    }

	    private void readToken(byte acceptFrom) throws IOException {
            totalBytes = 0;
            while ((by=nextByte())<acceptFrom);
            byteBuf[totalBytes++] = by;
            while ((by=nextByte())>=acceptFrom){
                byteBuf[totalBytes++] = by;
            }
	    }

	    public int nextInt() throws IOException{
			readToken();
			int num=0, i=0;
			boolean sign=false;
			if (byteBuf[i]==MINUS){
				sign = true;
				i++;
			}
			for (; i<totalBytes; i++){
				num*=10;
				num+=byteBuf[i]-ZERO;
			}
			return sign?-num:num;
		}

		public long nextLong() throws IOException{
			readToken();
			long num=0;
			int i=0;
			boolean sign=false;
			if (byteBuf[i]==MINUS){
				sign = true;
				i++;
			}
			for (; i<totalBytes; i++){
				num*=10;
				num+=byteBuf[i]-ZERO;
			}
			return sign?-num:num;
		}

		/*
		//TODO test Unix/Windows formats
		public void toNextLine() throws IOException{
			while ((ch=nextChar())!='\n');
		}
		*/

		public double nextDouble() throws IOException{
			readToken();
			char[] token = new char[totalBytes];
			for (int i = 0; i < totalBytes; i++) {
				token[i] = (char)byteBuf[i];
			}
			return Double.parseDouble(new String(token));
		}

	}

	public static void main(String[] args) {
		new Codeforces_Div2_D().run();
	}

}


import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;

public class D {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void init() throws FileNotFoundException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	int[] readArr(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = readInt();
		}
		return res;
	}

	long[] readArrL(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = readLong();
		}
		return res;
	}

	public static void main(String[] args) {
		new D().run();
	}

	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	void solve() throws Exception {
		double a = readInt();
		double b = readInt();
		double m = readInt();
		double vx = readDouble();
		double vy = readDouble();
		double vz = readDouble();
		double x = a * 1.0 / 2;
		double y = m;
		double z = 0;
		while (true) {
			double tmin = 10000000;
			int r = 0;
			if (vx > 0) {
				double curT = (a - x) / vx;
				if (tmin > curT) {
					r = 1;
					tmin = curT;
				}
			} else {
				double curT = -x / vx;
				if (tmin > curT) {
					r = 1;
					tmin = curT;
				}
			}

			if (vy > 0) {
				throw new Exception();
			} else {
				tmin = min(tmin, -y / vy);
			}

			if (vz > 0) {
				double curT = (b - z) / vz;
				if (tmin > curT) {
					r = 2;
					tmin = curT;
				}
			} else {
				double curT = -z / vz;
				if (tmin > curT) {
					r = 2;
					tmin = curT;
				}
			}
			x = x + tmin * vx;
			y = y + tmin * vy;
			z = z + tmin * vz;

			if (abs(y) < 0.0000001 || y < 0) {
				break;
			}

			if(r == 1) vx = -vx;
			if(r == 2) vz = -vz;
		}
		out.println(x + " " + z);
	}

	void maxHepify(int[] a, int i, int length) {
		int l = (i << 1) + 1;
		int r = (i << 1) + 2;
		int largest = i;
		if (l < length && a[l] > a[largest])
			largest = l;
		if (r < length && a[r] > a[largest])
			largest = r;
		if (largest != i) {
			a[largest] += a[i];
			a[i] = a[largest] - a[i];
			a[largest] -= a[i];
			maxHepify(a, largest, length);
		}
	}

	void buildMaxHeap(int[] a) {
		for (int i = a.length / 2 - 1; i >= 0; i--) {
			maxHepify(a, i, a.length);
		}
	}

	void heapSort(int[] a) {
		buildMaxHeap(a);
		for (int i = a.length - 1; i > 0; i--) {
			a[i] += a[0];
			a[0] = a[i] - a[0];
			a[i] -= a[0];
			maxHepify(a, 0, i);
		}
	}

	int[] zFunction(char[] s) {
		int[] z = new int[s.length];
		z[0] = 0;
		for (int i = 1, l = 0, r = 0; i < s.length; ++i) {
			if (i <= r)
				z[i] = min(r - i + 1, z[i - l]);
			while (i + z[i] < s.length && s[z[i]] == s[i + z[i]])
				++z[i];
			if (i + z[i] - 1 > r) {
				l = i;
				r = i + z[i] - 1;
			}
		}
		return z;
	}

	int[] prefixFunction(char[] s) {
		int[] pr = new int[s.length];
		for (int i = 1; i < s.length; ++i) {
			int j = pr[i - 1];
			while (j > 0 && s[i] != s[j])
				j = pr[j - 1];
			if (s[i] == s[j])
				++j;
			pr[i] = j;
		}
		return pr;
	}

	int ModExp(int a, int n, int mod) {
		int res = 1;
		while (n != 0)
			if ((n & 1) != 0) {
				res = (res * a) % mod;
				--n;
			} else {
				a = (a * a) % mod;
				n >>= 1;
			}
		return res;
	}

	public static class Utils {

		private Utils() {
		}

		public static void mergeSort(int[] a) {
			mergeSort(a, 0, a.length - 1);
		}

		private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
			final int MAGIC_VALUE = 50;
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergeSort(a, leftIndex, middleIndex);
					mergeSort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex,
				int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++]
							: rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}
	}

	boolean isPrime(int a) {
		for (int i = 2; i <= sqrt(a); i++)
			if (a % i == 0)
				return false;
		return true;
	}

	static double distance(long x1, long y1, long x2, long y2) {
		return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	}

	static long gcd(long a, long b) {
		if (min(a, b) == 0)
			return max(a, b);
		return gcd(max(a, b) % min(a, b), min(a, b));
	}

	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}
}

/*
 * class Treap<K extends Comparable<K>>{
 *
 * public K x; public double y; public Treap<K> left; public Treap<K> right;
 *
 * public Treap(K x, double y, Treap<K> left, Treap<K> right) { this.x = x;
 * this.y = y; this.left = left; this.right = right; }
 *
 * public static <K extends Comparable<K>> Treap<K> merge(Treap<K> l, Treap<K>
 * r){ if(l == null) return r; if(r == null) return l; if(l.y > r.y){ return new
 * Treap<K>(l.x, l.y, l.left, merge(l.right, r)); } else{ return new
 * Treap<K>(r.x, r.y, merge(l, r.left), r.right); } }
 *
 * public void split(K x, Treap<K> left, Treap<K> right){ Treap<K> newTreap =
 * null; if(this.x.compareTo(x) <= 0){ if(this.right == null){ right = null; }
 * else{ right.split(x, newTreap, right); } left = new Treap<K>(this.x, this.y,
 * left, newTreap); } else{ if(this.left == null){ left = null; } else{
 * left.split(x, left, newTreap); } right = new Treap<K>(x, y, newTreap, right);
 * } }
 *
 * public Treap<K> add(K x){ Treap<K> left = null, right = null; this.split(x,
 * left, right); Treap<K> temp = new Treap<K>(x, random(), null, null); return
 * merge(merge(left, temp), right); }
 *
 * @SuppressWarnings("null") public Treap<K> remove(K x){ Treap<K> left = null,
 * temp = null, right = null; this.split(x, left, right); right.split(x, temp,
 * right); return merge(left, right); }
 *
 * public static <K extends Comparable<K>> Treap<K> build(K[] a){ Treap<K> temp
 * = new Treap<K>(a[0], random(), null, null); for(int i = 1; i < a.length;
 * i++){ temp = temp.add(a[i]); } return temp; } }
 */


import java.io.*;
import java.util.*;
import java.math.*;

public class P203D {

  private final double dt = 10000000;
  private final double EPS = 1e-7;

  public PrintWriter run() {
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double m = sc.nextDouble();
    double vx = sc.nextDouble() / dt / m;
    double vy = sc.nextDouble() / dt / m;
    double vz = sc.nextDouble() / dt / m;

    double x = a / 2;
    double y = m;
    double z = 0;

    while (y > EPS) {
      x += vx;
      y += vy;
      z += vz;

      if (x <= 0 || x >=a) {
        vx = -vx;
      }
      if (z <= 0 || z >=b) {
        vz = -vz;
      }
//System.out.println("X = " + x + "\tY = " + y + "\tZ = " + z);
//System.console().readLine();
    }

    pw.println(x + " " + z);

    return pw;
  }

  private Scanner sc = new Scanner(new BufferedInputStream(System.in));
  private PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));

  public static void main(String... args) throws Exception {
    new P203D().run().close();
  }

}


import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Айдос
 */
public class Main{

    public static void main(String[] args){
     Scanner sc = new Scanner(System.in);

     int n = sc.nextInt();
     int m = sc.nextInt();
     int num[] = {n,m};
     int a [] =new int[]{0,0,0,0,0,0};
     for(int i=0;i<2;i++){
      while(true){
       if(num[i]%2==0) {num[i]/=2;if(i==0) a[2]++;else a[2]--;}
       else if(num[i]%3==0) {num[i]/=3; if(i==0) a[3]++;else a[3]--;}
       else if(num[i]%5==0) {num[i]/=5;  if(i==0) a[5]++;else a[5]--;}
       else break;
      }
     }
     if(a[0]!=a[1]) System.out.print(-1);
     else System.out.print(Math.abs(a[2])+Math.abs(a[3])+Math.abs(a[5]));
    }

}


import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Айдос
 */
public class CodeForces {

    public static void main(String[] args){
     Scanner sc = new Scanner(System.in);

     int n = sc.nextInt();
     int m = sc.nextInt();
     int num[] = {n,m};
     int a [] =new int[]{0,0,0,0,0,0};
     for(int i=0;i<2;i++){
      while(true){
       if(num[i]%2==0) {num[i]/=2;if(i==0) a[2]++;else a[2]--;}
       else if(num[i]%3==0) {num[i]/=3; if(i==0) a[3]++;else a[3]--;}
       else if(num[i]%5==0) {num[i]/=5;  if(i==0) a[5]++;else a[5]--;}
       else break;
      }
     }
     if(a[0]!=a[1]) System.out.println(-1);
     else System.out.println(Math.abs(a[2])+Math.abs(a[3])+Math.abs(a[5]));
    }

}


import java.util.*;
import java.io.*;

/**
 *
 * @author tarsx
 */
public class CF_376B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.println(solve(a,b));
    }

    static int solve(int a, int b) {
        int[] aa = countDiviArr(a);
        int[] ba = countDiviArr(b);
        int sol = Math.abs(aa[0] - ba[0]) + Math.abs(aa[1] - ba[1]) + Math.abs(aa[2] - ba[2]);
        if (a / (Math.pow(2, aa[0]) * Math.pow(3, aa[1]) * Math.pow(5,aa[2])) !=
                b / (Math.pow(2, ba[0]) * Math.pow(3, ba[1]) * Math.pow(5,ba[2])))
            return -1;
        return sol;
    }

    static int[] countDiviArr(int cislo) {
        int[] solution = {countDiv(cislo,2), countDiv(cislo,3),countDiv(cislo,5)};
        return solution;
    }

    static int countDiv(int cislo, int d) {
        int i = 0;
        while (cislo % d == 0) {
            cislo /= d;
            i++;
        }
        return i;
    }


import java.util.*;
public class demo2 {

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int a,b,res=0,p=0,q=0;
		int a=in.nextInt(), b = in.nextInt();
		if(a>=1&&b<=1000000000)
		{
			for(int i=2;i<=5;i++)
			{
				p = 0, q = 0;
				if(i!=4){
				while(a%i==0) {a/=i; p++;}
				while(b%i==0) {b/=i; q++;}
				res+=Math.abs(p-q);
				}
			}
			if(a==b)
				System.out.println(res);
			else
				System.out.println(-1);
	}
}
}


package one;
import java.util.Scanner;

public class Zadacha1 {

	public static void main(String[] args) {
		Per abc = new Per();
		abc.solve();
		abc.print();

	}

}
class Per{
int x1;
int y1;
int x2;
int y2;
int p;
Per(){
	Scanner con = new Scanner(System.in);
		x1 = con.nextInt();
		y1 = con.nextInt();
		x2 = con.nextInt();
		y2 = con.nextInt();
		con.close();
	}
void solve(){
	p=2*(Math.abs(x2-x1)+1) + 2*(Math.abs(y2-y1)+1);
	}
void print(){
	System.out.println(p);
}
}


package com.company;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
	    //Scanner in = new Scanner(System.in);
        String str2 = null, str1 = null;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            str1 = br.readLine();
            str2 = br.readLine();
        } catch (Exception e) {
        }
        String[] strAr1 = str1.split(" ");
        String[] strAr2 = str2.split(" ");

        int cx = Integer.parseInt(strAr1[0]);
        int cy = Integer.parseInt(strAr1[1]);
        int fx = Integer.parseInt(strAr2[0]);
        int fy = Integer.parseInt(strAr2[1]);

        if (cx == fx) {
            System.out.println(
                    (Math.abs(cy-fy)*2)+6
            );
            return;
        }
        if (cy == fy) {
            System.out.println(
                    (Math.abs(cx-fx)*2)+6
            );
            return;
        }
        System.out.println(
                Math.abs(cx-fx)*2 + Math.abs(cy - fy)*2 + 4
        );
    }
}

/*

        String str2 = null;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            str2 = br.readLine();
        } catch (Exception e) {
        }
        String[] strAr = str2.split(" ");

 */


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package acm;

import java.util.Scanner;

/**
 *
 * @author rokk-
 */
public class ACM2017M {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner scanner = new Scanner(System.in);
        int rx = scanner.nextInt();
        int ry = scanner.nextInt();
        int fx = scanner.nextInt();
        int fy = scanner.nextInt();
        int dx = rx-fx;
        if (dx==0){
            dx = 1;
        }
        dx = Math.abs(dx)+1;
        int dy = ry-fy;
        if (dx==0){
            dx = 1;
        }
        dy = Math.abs(dy)+1;
        System.out.println(dx*2+dy*2);
    }

}


package com.company;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    Scanner in = new Scanner(System.in);

//        String str2 = null, str1 = null;
//        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
//            str1 = br.readLine();
//            str2 = br.readLine();
//        } catch (Exception e) {
//        }
//        String[] strAr1 = str1.split(" ");
//        String[] strAr2 = str2.split(" ");
//
//        int cx = Integer.parseInt(strAr1[0]);
//        int cy = Integer.parseInt(strAr1[1]);
//        int fx = Integer.parseInt(strAr2[0]);
//        int fy = Integer.parseInt(strAr2[1]);

        int cx = in.nextInt();
        int cy = in.nextInt();
        int fx = in.nextInt();
        int fy = in.nextInt();

        if (cx == fx) {
            System.out.println(
                    (Math.abs(cy-fy)*2)+6
            );
            return;
        }
        if (cy == fy) {
            System.out.println(
                    (Math.abs(cx-fx)*2)+6
            );
            return;
        }
        System.out.println(
                Math.abs(cx-fx)*2 + Math.abs(cy - fy)*2 + 4
        );
    }
}

/*

        String str2 = null;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            str2 = br.readLine();
        } catch (Exception e) {
        }
        String[] strAr = str2.split(" ");

 */


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class 15215
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		int n;
		Scanner in = new Scanner(System.in);
		int i,j;
		n=in.nextInt();
		int[][] mat=new int[n][n];
		for(i=0;i<n;i++)
		{
			mat[0][i]=1;
			mat[i][0]=1;
		}
		for(i=1;i<n;i++)
		{
			for(j=1;j<n;j++)
			{
				mat[i][j]=mat[i-1][j]+mat[i][j-1];
			}
		}
		System.out.println(mat[n-1][n-1]);
	}
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class 15215
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		int n;
		Scanner in = new Scanner(System.in);
		n=in.nextInt();
		int i,j;
		int[][] mat=new int[n][n];
		for(i=0;i<n;i++)
		{
			mat[0][i]=1;
			mat[i][0]=1;
		}
		for(i=1;i<n;i++)
		{
			for(j=1;j<n;j++)
			{
				mat[i][j]=mat[i-1][j]+mat[i][j-1];
			}
		}
		System.out.println(mat[n-1][n-1]);
	}
}


import java.util.*;
import java.io.*;
 public class sol{

    public static void main(String s[])
    {
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
         int n=Integer.parseint(br.readLine());
         int i=0,j=0;
         int a[]=new int[n][n];
         for(j=0;j<n;j++)
         a[0][j]=1;
         j=0;
          for( i=0;i<n;i++)
         a[i][0]=1;
         for(i=1;i<n;i++)
         {
              for(j=1;j<n;j++)
         {
             a[i][j]=a[i-1][j]+a[i][j-1];
         }
         }

         System.out.println(a[n-1][n-1]);

    }
}


import java.util.Scanner;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int x[][]=new int[n][n];
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++){
                if(i==0||j==0)
                    x[i][j]=1;
                else
                    x[i][j]=x[i-1][j]+x[i][j-1];
            }
        System.out.print(x[n-1][n-1]);
    }


import java.util.*;
import java.io.*;
public class Solution{
  public  static boolean isPrime(long n)
    {
       for(int i=2;i<=Math.sqrt(n);i++) {
        if(n%i==0)return false;
    }
    return true;
    }

    public static void main(String[] args) throws IOException
    {

       BufferedReader br = new BufferedReader(
                              new InputStreamReader(System.in));
         StringBuffer out=new StringBuffer();
         int t=Integer.parseInt(br.readLine());
         for(int i=0;i<t;i++){
                  StringTokenizer st=new StringTokenizer(br.readLine());
                  long a=Long.parseLong(st.nextToken());
                    long b=Long.parseLong(st.nextToken());
                    if(a-b!=1){
                       out.append("NO");
                             out.append("\n");
                        continue;
                    }else{
                        long sum=a+b;
                        if(isPrime(sum))
                        {
                             out.append("YES");
                             out.append("\n");
                        continue;
                        }else{
                             out.append("NO");
                             out.append("\n");
                        continue;
                        }
                    }

    }
           System.out.println(out);

    }}

}


import java.util.*;

public class Stupid
{
    public static void main(String[] args)
    {
        Scanner s= new Scanner(System.in);
        int l= s.nextInt();
        for(int x=0;x<l;x++)
        {
           long a= s.nextLong();
           long b= s.nextLong();

           if(isPrime(a+b)&&a-b==1)
           System.out.println("YES");
           else
           System.out.println("NO");
        }
        s.close();
    }
    public static String isPrime(long lol)
    {
        for(int x=2;x<Math.sqrt(lol);x++)
        {
            if(lol%x==0)
            {return false}
        }
        return true;
    }
}


import java.util.*;
public class A
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int q=sc.nextInt();
        while(q-->0)
        {
            long a=sc.nextLong();
            long b=sc.nextLong();
            long x=(a+b);
            long y=(a-b);
            if(x==1||y==1)
            Systm.out.println("YES");
            else
            Systm.out.println("NO");
        }
    }
}


import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

    static ArrayList<Integer> primes;
    static int[] isComposite;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int t = sc.nextInt();
        sieve((int) (1e6+1));
        while (t-- > 0) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            if ((a - b == 1) && isPrime(a + b)) out.println("YES");
            else out.println("NO");
        }
        out.flush();
        out.close();
    }

    static boolean isPrime(long N) {
        if (N < isComposite.length)
            return isComposite[(int) N] == 0;
        for (int p : primes){
            if (N % Shopping_Trip.p == 0)
                return false;
            if (1l*p*p>N) break;
        }
        return true;
    }

    static void sieve(int N)    // O(N log log N)
    {
        isComposite = new int[N + 1];
        isComposite[0] = isComposite[1] = 1;            // 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i)                    //can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0)                    //can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if (1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)    // j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    }

    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }

}


public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            int c= scan.nextInt();
            int d = scan.nextInt();
            int n = scan.nextInt();
            int m = scan.nextInt();
            int k = scan.nextInt();
            if(k>=n*m)System.out.println(0);
            else{
                int temp=n*m-k;
                if((double)c/n>d){
                    System.out.println((n*m-k)*d);
                }
                else{
                    int ans=temp/n;
                    int x = ans*c;
                    if(ans*n==temp){
                        System.out.println(x);
                    }
                    else{
                        int t =temp-ans*n;
                        if(t*d<c)x+=t*d;
                        else x+=c;
                        System.out.println(x);
                    }
                }
            }
        }
    }
}


import java.io.*;
public class _417_A {
	boolean testOutput=true;
	public void runTestCases() throws Exception{
//		Case 0
		input=
		"1 10 "+
		"7 2 "+
		"1 ";
		runTest(input,
		"2 ");

//		Case 1
		input=
		"2 2 "+
		"2 1 "+
		"2 ";
		runTest(input,
		"0 ");

//		Case 1
		input=
		"1 1 "+
		"100 100 "+
		"1 ";
		runTest(input,
		"0 ");

	}

	public void compare(String rcAnswer, String realAnswer){
		realAnswer=realAnswer.trim();
		rcAnswer=rcAnswer.trim();
		if(realAnswer.equals(rcAnswer)){
			System.out.println("[Passed] Case "+nroCases);
		}else{
			failed=true;
			System.out.println("rChi "+rcAnswer);
			System.out.println("Expected "+realAnswer);
			System.out.println("[Failed] Case "+nroCases);
//			System.exit(0);
		}
		nroCases++;
	}

	public void runTest(String input, String output) throws Exception{
		r.in= new ByteArrayInputStream(input.getBytes());
		r.run();
		if(testOutput){
			compare(baos.toString(), output);
		}else{
			System.out.println(baos.toString());
		}
		baos.reset();
//		r.in.
	}
	_417_A_Elimination r;
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	private void init() throws Exception{
		r = new _417_A_Elimination();
		r.out = new PrintWriter(baos);
		runTestCases();
		if(testOutput && !failed){
			System.out.println("All test cases [Passed]");
		}
	}
	private String input;
	private int nroCases=1;
	private boolean failed=false;
	public static void main(String[] args) throws Exception {
		new _417_A().init();
	}

}


import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

public class First {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int c = in.nextInt();
        int d = in.nextInt();
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        int totalRemParticipants = n * m - k;
        if (totalRemParticipants <= 0) {
            out.println('0');
            return;
        }
        int ans = 0;
        if (c <= n * d) {
            if (totalRemParticipants % n == 0) {
                ans = (totalRemParticipants / n) * c;
            } else {
                int rem = Math.abs((totalRemParticipants - n) % n);
                ans = Math.min( (totalRemParticipants / n) * c + c, (totalRemParticipants / n) * c + d * rem);

            }
        }  else {
            ans = d * totalRemParticipants;
        }
        out.println(ans);
    }
}


import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

import javax.security.auth.kerberos.KerberosKey;

import static java.lang.Math.*;

public class Main {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void init() throws FileNotFoundException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	int gcd(int a, int b) {
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public void fillSieve() {
	    Arrays.fill(primes,true);
	    primes[0]=primes[1]=false;
	    for (int i=2;i<primes.length;i++) {
	        if(primes[i]) {
	            for (int j=2;i*j<primes.length;j++) {
	                primes[i*j]=false;
	            }
	        }
	    }
	}

	int fib(int n) {
		if (n == 1)
			return 1;
		if (n == 2)
			return 2;
		else
			return fib(n - 1) + fib(n - 2);
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	public static void main(String[] args) {
		new Main().run();
		// Sworn to fight and die
	}

	public static void mergeSort(int[] a) {
		mergeSort(a, 0, a.length - 1);
	}

	private static void mergeSort(int[] a, int levtIndex, int rightIndex) {
		final int MAGIC_VALUE = 50;
		if (levtIndex < rightIndex) {
			if (rightIndex - levtIndex <= MAGIC_VALUE) {
				insertionSort(a, levtIndex, rightIndex);
			} else {
				int middleIndex = (levtIndex + rightIndex) / 2;
				mergeSort(a, levtIndex, middleIndex);
				mergeSort(a, middleIndex + 1, rightIndex);
				merge(a, levtIndex, middleIndex, rightIndex);
			}
		}
	}

	private static void merge(int[] a, int levtIndex, int middleIndex,
			int rightIndex) {
		int length1 = middleIndex - levtIndex + 1;
		int length2 = rightIndex - middleIndex;
		int[] levtArray = new int[length1];
		int[] rightArray = new int[length2];
		System.arraycopy(a, levtIndex, levtArray, 0, length1);
		System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
		for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {
			if (i == length1) {
				a[k] = rightArray[j++];
			} else if (j == length2) {
				a[k] = levtArray[i++];
			} else {
				a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]
						: rightArray[j++];
			}
		}
	}

	private static void insertionSort(int[] a, int levtIndex, int rightIndex) {
		for (int i = levtIndex + 1; i <= rightIndex; i++) {
			int current = a[i];
			int j = i - 1;
			while (j >= levtIndex && a[j] > current) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = current;
		}
	}

	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	class LOL implements Comparable<LOL> {
		int x;
		int y;

		public LOL(int x, int y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(LOL o) {

			//if (y == o.y)
			//	return (o.x - x);
			return x - o.x; // ---->
			// return o.x - x; // <----
			// return o.y-y;
		}

	}

	public int unusualSquare(int [][] a, int n) {
		int s = 0;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				s += a[i][j]*a[j][i];
		return s % 2;
	}

	public void solve() throws IOException {
		int c = readInt();
		int d = readInt();
		int n = readInt();
		int m = readInt();
		int k = readInt();
		int s = 0;
		int x = 0;
		int y = 0;
		while (x*n + y < n*m - k) {
			x++;
		}
		int s1 = c*x;
		x = 0;
		while (x*n + y < n*m - k) {
			y++;
		}
		int s2 = d*y;
		out.print(min(s1, s2));
	}
}


import java.lang.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		String a = in.nextLine();
		String b = in.nextLine();
		int n = a.length();
		int[] num = new int[10];
		for(int i = 0; i < n; i++)
		{
			int t = Integer.parseInt(a.substring(i, i+1));
			num[t] += 1;
		}
		String ans = "";
		int sm = 0;
		for(int i = 0; i < n; i++)
		{
			int t = Integer.parseInt(b.substring(i, i + 1));
			for(int j = t; j >= 0; j--)
			{
				if(num[j] > 0)
				{
					num[j] -= 1;
					sm = smallest(num);
					String nt = generate(sm, n);
					if(Long.parseLong(b) >= Long.parseLong(ans + nt + ""))
					{
						break;
					}
					num[j] += 1;
				}
			}
		}
		System.out.println(ans);
	}
	static int smallest(String[] num)
	{
		for(int i = 0; i < 10; i++)
		{
			if(num[i] > 0)
			{
				return i;
			}
		}
	}
	static String generate(int sm, int n)
	{
		String tmp = "";
		for(int i = sm + 1; i < n; i++)
		{
			tmp += sm + "";
		}
		return tmp;
	}
}


import java.util.*;
import java.io.*;
import java.math.*;

public class scorify{
	public static void main(String[] args){
	Scanner in=new Scanner(System.in);
    String first = in.next();
    String second = in.next();
    String result = "";

    ArrayList<Integer> fl = new ArrayList<Integer>();
    for (int i=0 ; i<first.length() ; i++) {
        fl.add(Integer.parseInt(first.charAt(i)+""));
    }
    ArrayList<Integer> sl = new ArrayList<Integer>();
    for(int i=0 ; i<second.length() ; i++) {
        sl.add(Integer.parseInt(second.charAt(i)+""));
    }

    if(second.length()==first.length()) {
        for(int i=0 ; i<first.length() ; i++) {
            for(int j=0 ; j<first.length() ; j++) {
                if(i==j){
                    System.out.println("testing");
                }
            }
        }

    System.our.print(result);
    }else{
         Collections.sort(fl,Collections.reverseOrder());
         for (int dig:fl){
             System.out.print(dig);
         }
    }

	}
}


import java.lang.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		String a = in.nextLine();
		String b = in.nextLine();
		int n = a.length();
		int[] num = new int[10];
		for(int i = 0; i < n; i++)
		{
			int t = Integer.parseInt(a.substring(i, i+1));
			num[t] += 1;
		}
		String ans = "";
		int sm = 0;
		for(int i = 0; i < n; i++)
		{
			int t = Integer.parseInt(b.substring(i, i + 1));
			for(int j = t; j >= 0; j--)
			{
				if(num[j] > 0)
				{
					num[j] -= 1;
					sm = smallest(num);
					String nt = generate(sm, n);
					if(Long.parseLong(b) >= Long.parseLong(ans + nt + ""))
					{
						break;
					}
					num[j] += 1;
				}
			}
		}
		System.out.println(ans);
	}
	static int smallest(int[] num)
	{
		for(int i = 0; i < 10; i++)
		{
			if(num[i] > 0)
			{
				return i;
			}
		}
	}
	static String generate(int sm, int n)
	{
		String tmp = "";
		for(int i = sm + 1; i < n; i++)
		{
			tmp += sm + "";
		}
		return tmp;
	}
}


import java.lang.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		String a = in.nextLine();
		String b = in.nextLine();
		int n = a.length();
		int[] num = new int[10];
		for(int = 0; i < n; i++)
		{
			int t = Integer.parseInt(a.substring(i, i+1));
			num[t] += 1;
		}
		String ans = "";
		int sm = 0;
		for(int i = 0; i < n; i++)
		{
			int t = Integer.parseInt(b.substring(i, i + 1));
			for(int j = t; j >= 0; j--)
			{
				if(num[j] > 0)
				{
					num[j] -= 1;
					sm = smallest(num);
					String nt = generate(sm, n);
					if(Long.parseLong(b) >= Long.parseLong(ans + nt + ""))
					{
						break;
					}
					num[j] += 1;
				}
			}
		}
		System.out.println(ans);
	}
	static int smallest(String[] num)
	{
		for(int i=0; i<10; i++)
		{
			if(num[i]>0)
			{
				return i;
			}
		}
	}
	static String generate(int sm, int n)
	{
		String tmp = "";
		for(int i=sm+1; i<n; i++)
		{
			tmp += sm + "";
		}
		return tmp;
	}
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author ayush
 */
import java.util.*;
public class WellKnownNumbers {
     static int a[]=new int[50];
    public static void main(String sp[])throws Exception
    {
    	int n;
        int temp;
            for(int i=0;i<50;i++)
                a[i]=-1;
            int s,k;
        Vector v=new Vector();
        Scanner sc=new Scanner(System.in);
        Enumeration er=v.elements();
        s=sc.nextInt();
        k=sc.nextInt();

        n=k;
        while(F(k,n)<s)
        {
         n++;
        }
        //for(int i=0;i<n-k;i++)
          //  System.out.println(a[i]);

        temp=s;

        while(temp!=0)
        {	//System.out.println("hi");
               if(a[n-k]<=temp)
               {
                    v.add(new Integer(a[n-k]));
                    temp=temp-a[n-k];
                    n--;
                }
                else
                   n--;

        }
        v.add(new Integer(0));
        System.out.println(v.size());
        while(er.hasMoreElements())
        {

            System.out.print(er.nextElement()+" ");
        }

    }
    static int F(int k,int n)
    {
        if(n<k)
            return 0;
        else
            if(k==n)
            {
                    a[n-k]=1;
                return a[n-k];
            }
            else
                if(a[n-k]!=-1)
                    return(a[n-k]);
                else
                {   int sum=0;
                    for(int i=1;i<=k;i++)
                        sum=sum+F(k,n-i);
                    a[n-k]=sum;
                }
        return a[n-k];
    }
}


import java.util.*;
import java.io.*;

public class Main225B
{
  static PrintWriter out=new PrintWriter(System.out);
  static Vector<Integer> val=new Vector<Integer>();
  static int k;

  static int getVal(int j)
  {
    if(j==k) return 1;
    else if(j<k) return 0;
    else return val.elementAt(j-k);
  }

  public static void main(String[] args) throws IOException
  {
    Scanner sc=new Scanner(System.in);
    val.add(1);
    int s=sc.nextInt();
    k=sc.nextInt();
    int[] a=new int[50];
    for(int i=0;i<50;i++)
    {
      a[i]=0;
      for(int j=k;j>0;j--)
      {
        a[i]+=getVal(k+1+i-j);
      }
      val.add(a[i]);
      if(a[i]>s) break;
    }
    Arrays.sort(a);
    Vector<Integer> sol=new Vector<Integer>();
    for(int i=a.length-1;i>=0&&s>0;i--)
    {
      if(a[i]>s) continue;
      else {
        sol.add(a[i]);
        s-=a[i];
      }
    }
    if(sol.size()==1)
    {
      sol.add(0);
    }
    out.println(sol.size());
    for(int j:sol)
      out.print(j+" ");
    out.flush();

  }
  static class Scanner
  {
    BufferedReader br;
    StringTokenizer tk=new StringTokenizer("");
    public Scanner(InputStream is)
        {
      br=new BufferedReader(new InputStreamReader(is));
    }
        public int nextInt() throws IOException
        {
          if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
          tk=new StringTokenizer(br.readLine());
          return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
              return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
          if(tk.hasMoreTokens())
            return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
          tk=new StringTokenizer("");
          return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
              return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
              return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
          long a[]=new long[n];
            for(int i=0;i<n;i++)
              a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
          int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
          long a[]=new long[n+1];
          for(int i=1;i<=n;i++)
                a[i]=nextLong();
          return a;
        }
  }
}