Problem: You are given an array of n elements, you must make it a co-prime array in as few moves as possible.

In each move you can insert any positive integral number you want not greater than 109 in any place in the array.

An array is co-prime if any two adjacent numbers of it are co-prime.

In the number theory, two integers a and b are said to be co-prime if the only positive integer that divides both of them is 1.

Input

The first line contains integer n (1 ≤ n ≤ 1000) — the number of elements in the given array.

The second line contains n integers ai (1 ≤ ai ≤ 109) — the elements of the array a.

Output

Print integer k on the first line — the least number of elements needed to add to the array a to make it co-prime.

The second line should contain n + k integers aj — the elements of the array a after adding k elements to it. Note that the new array should be co-prime, so any two adjacent values should be co-prime. Also the new array should be got from the original array a by adding k elements to it.

If there are multiple answers you can print any one of them.

Example

Input

3
2 7 28


Output

1
2 7 9 28

Solution (in JAVA):

Solution:

import java.util.Scanner;
import java.util.Stack;

public class coPrimeArray {

	public static void main(String[] args) {
		Scanner leitor = new Scanner(System.in);
		int n = leitor.nextInt();
		leitor.nextLine();
		String numbers = leitor.nextLine();
		String coPrime = makeArrayCoPrime(n, numbers);
		System.out.println(coPrime);
		leitor.close();
		return;
	}
	
	private static String makeArrayCoPrime(int n, String numbers){
		int qtdNumAdicionados = 0;
		int posicaoNum = 0;
		Stack<Integer> arrayNumCoPrime = new Stack<Integer>();
		String[] strNum = numbers.split(" ");
		Stack<Integer> arrayNumbers = new Stack<Integer>();
		int i = 0;
		for(String num: strNum){
			arrayNumbers.push(Integer.parseInt(num));
			i += 1;
		}
		
		if(n>1){
			while(posicaoNum < n-1){
				if(arrayNumCoPrime.isEmpty()) {
					arrayNumCoPrime.push(arrayNumbers.pop());
				}else {
					int isCoPrime = isCoPrime(arrayNumbers.peek(), arrayNumCoPrime.peek());
					if(isCoPrime == 0){
						arrayNumCoPrime.push(arrayNumbers.pop());
						posicaoNum += 1; 
					}else{						
						arrayNumCoPrime.push(isCoPrime);
						arrayNumCoPrime.push(arrayNumbers.pop());
						qtdNumAdicionados += 1;
						posicaoNum += 1; 
					}
				}
			}
		}else{
			if(n==1)
				arrayNumCoPrime.push(arrayNumbers.pop());
		}
		
		String numAdc = String.valueOf(qtdNumAdicionados + "\n");
		String[] arrayCoPrimeStr = new String[n+qtdNumAdicionados];
		int contador = 0;
		if(n>0){
			while(!(arrayNumCoPrime.isEmpty())) {
				arrayCoPrimeStr[contador] = String.valueOf(arrayNumCoPrime.pop());	
				contador += 1;
			}
		}
		String arrayInStr = String.join(" ", arrayCoPrimeStr);
		String resposta = numAdc+arrayInStr;
		return resposta;
	}
	
	private static int isCoPrime(int num1, int num2){
		int mdc = calcMdc(num1, num2);
		int novoNum = 0;
		if(mdc!=1){	
			while(mdc != 1){
				novoNum += 1;
				mdc = calcMdc(num1, novoNum);
				if(mdc == 1){
					mdc = calcMdc(novoNum, num2);
				}
			}
			return novoNum;
		}else{
			return 0;
		}
	}

	private static int calcMdc(int numDivisor, int numDividendo){
		int mdc = 1;
		int resto = numDivisor%numDividendo;
		
		while(resto!=0){
			numDivisor = numDividendo;
			numDividendo = resto;
			resto = numDivisor%numDividendo;
		}
		mdc = numDividendo;

		return mdc;
	}
}