Problem: The problem uses a simplified TCP/IP address model, please read the statement carefully.

An IP address is a 32-bit integer, represented as a group of four decimal 8-bit integers (without leading zeroes), separated by commas. For example, record 0.255.1.123 shows a correct IP address and records 0.256.1.123 and 0.255.1.01 do not. In the given problem an arbitrary group of four 8-bit integers is a correct IP address.

Our hero Polycarpus still works as a system administrator in some large corporation. He likes beautiful IP addresses. To check if some IP address is beautiful, he should do the following:

  1. write out in a line four 8-bit numbers of the IP address, without the commas; 
  2. check if the resulting string is a palindrome. 



Let us remind you that a palindrome is a string that reads the same from right to left and from left to right.

For example, IP addresses 12.102.20.121 and 0.3.14.130 are beautiful (as strings "1210220121" and "0314130" are palindromes), and IP addresses 1.20.20.1 and 100.4.4.1 are not.

Polycarpus wants to find all beautiful IP addresses that have the given set of digits. Each digit from the set must occur in the IP address at least once. IP address must not contain any other digits. Help him to cope with this difficult task.

Input

The first line contains a single integer n (1 ≤ n ≤ 10) — the number of digits in the set. The second line contains the set of integers a1, a2, ..., an (0 ≤ ai ≤ 9). It is guaranteed that all digits in the set are distinct.

Output

In the first line print a single integer k — the number of beautiful IP addresses that contain the given set of digits. In the following k lines print the IP addresses, one per line in the arbitrary order.

Examples

Input

6
0 1 2 9 8 7


Output

6
78.190.209.187
79.180.208.197
87.190.209.178
89.170.207.198
97.180.208.179
98.170.207.189


Input

1
4


Output

16
4.4.4.4
4.4.4.44
4.4.44.4
4.4.44.44
4.44.4.4
4.44.4.44
4.44.44.4
4.44.44.44
44.4.4.4
44.4.4.44
44.4.44.4
44.4.44.44
44.44.4.4
44.44.4.44
44.44.44.4
44.44.44.44

Solution (in JAVA):

Solution:
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class C{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n;
	int[] a;

	void run(){
		n=sc.nextInt();
		a=new int[n];
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
		}
		solve();
	}

	void solve(){
		if(n>=7){
			println("0");
			return;
		}
		is=new int[12];
		set=new HashSet<String>();
		for(int d=4; d<=12; d++){
			fill(is, -1);
			rec(0, d);
		}
		println(set.size()+"");
		for(String s : set){
			println(s);
		}
	}

	int[] is;
	HashSet<String> set;

	void rec(int at, int d){
		if(at==(d+1)/2){
			boolean[] exists=new boolean[10];
			for(int i : is){
				if(i>=0){
					exists[i]=true;
				}
			}
			for(int i : a){
				if(!exists[i]){
					return;
				}
			}
			// debug(is);
			// isを適当に分割
			for(int i1=1; i1<=3; i1++){
				for(int i2=1; i2<=3; i2++){
					for(int i3=1; i3<=3; i3++){
						for(int i4=1; i4<=3; i4++){
							int x1=i1, x2=x1+i2, x3=x2+i3, x4=x3+i4;
							if(x4!=d){
								continue;
							}
							boolean ok=true;
							ok&=ok(is, 0, x1);
							ok&=ok(is, x1, x2);
							ok&=ok(is, x2, x3);
							ok&=ok(is, x3, x4);
							if(ok){
								StringBuilder sb=new StringBuilder();
								append(sb, is, 0, x1);
								append(sb, is, x1, x2);
								append(sb, is, x2, x3);
								append(sb, is, x3, x4);
								sb.deleteCharAt(sb.length()-1);
								// debug(sb.toString());
								set.add(sb.toString());
							}
						}
					}
				}
			}
			return;
		}
		for(int i : a){
			is[at]=is[d-1-at]=i;
			rec(at+1, d);
			is[at]=is[d-1-at]=-1;
		}
	}

	boolean ok(int[] is, int s, int t){
		if(t-s>=2&&is[s]==0){
			return false;
		}
		int val=0;
		for(int i=s; i<t; i++){
			val=val*10+is[i];
		}
		return val>=0&&val<=255;
	}

	void append(StringBuilder sb, int[] is, int s, int t){
		for(int i=s; i<t; i++){
			sb.append(is[i]);
		}
		sb.append('.');
	}

	void println(String s){
		System.out.println(s);
	}

	void print(String s){
		System.out.print(s);
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args){
		Locale.setDefault(Locale.US);
		new C().run();
	}
}