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.*;

//@SuppressWarnings("unused")
public class C {

	private final static boolean autoflush = false;

	private static final int INF = (int) 1e9;

	Set<String> res = new HashSet<String>();
	boolean [] C = new boolean [10];
	Integer [] D;

	public C () {
		sc.nextInt();
		D = sc.nextInts();

		for (int d : D)
			C[d] = true;

		String [] Z = { "0", "00", "000", "0000", "00000" };
		for (int x = 0; x < 1000000; ++x) {
			String S = "" + x;
			solve(S);
			if (C[0])
				for (String z : Z)
					if (S.length() + z.length() <= 6)
						solve(z + S);
		}

		print(res.size());
		for (String s : res)
			print(s);
	}

	int missing(String S) {
		int [] K = new int [10]; int res = 0;
		for (int i = 0; i < S.length(); ++i)
			++K[S.charAt(i) - '0'];
		for (int i = 0; i < 10; ++i) {
			if (C[i] && K[i] == 0)
				++res;
			if (!C[i] && K[i] != 0)
				return INF;
		}
		return res;
	}

	void solve(String S1) {
		int missing = missing(S1);
		String S2 = reverse(S1);
		if (missing == 0) {
			handle(S1 + S2);
			handle(S1 + S2.substring(1));
		}

		if (missing <= 1)
			if (S1.length() < 6)
				for (int d : D)
					handle(S1 + d + S2);
	}


	void handle(String Z) {
		char [] Q = Z.toCharArray(); int N = Q.length;
		if (N < 4 || N > 12)
			return;
		if (missing(Z) != 0)
			return;

		int [] A = new int [4];
		cut(A, Q, 0, 0);
	}

	void cut(int [] A, char [] Q, int p, int Z) {
		int N = Q.length;
		if (Z == 3) {
			A[3] = calc(Q, p, N);
			if (A[3] < 256) {
				StringBuilder B = new StringBuilder();
				for (int j : rep(4))
					B.append(".").append(A[j]);
				res.add(B.toString().substring(1));
			}
		} else
			for (int i = 1; i <= 3 && p + i < N; ++i) {
				A[Z] = calc(Q, p, p+i);
				if (A[Z] < 256)
					cut(A, Q, p+i, Z+1);
			}
	}

	int calc(char [] Q, int p, int q) {
		int res = 0;
		if (p == q-1) {
			res = Q[p] - '0';
			return res;
		}

		if (Q[p] == '0')
			return INF;

		for (int i = p; i < q; ++i)
			res = 10*res + (Q[i] - '0');
		return res;
	}

	////////////////////////////////////////////////////////////////////////////////////
	private static int [] rep(int N) { return rep(0, N); }
	private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	private static String reverse (String S) { return new StringBuilder(S).reverse().toString(); }
	////////////////////////////////////////////////////////////////////////////////////
	private final static MyScanner sc = new MyScanner();
	private static class MyScanner {
		private String next() {
			newLine();
			return line[index++];
		}
		private int nextInt() {
			return Integer.parseInt(next());
		}
		private String [] nextStrings() {
			line = null;
			return readLine().split(" ");
		}
		private Integer [] nextInts() {
			String [] L = nextStrings();
			Integer [] res = new Integer [L.length];
			for (int i : rep(L.length))
				res[i] = Integer.parseInt(L[i]);
			return res;
		}
		//////////////////////////////////////////////
		private boolean eol() {
			return index == line.length;
		}
		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error (e);
			}
		}
		private final java.io.BufferedReader r;
		private MyScanner () {
			this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in)));
		}
		private MyScanner (java.io.BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}
		private String [] line;
		private int index;
		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}
	private static void print (Object o, Object... a) {
		printDelim(" ", o, a);
	}
	private static void printDelim (String delim, Object o, Object... a) {
		pw.println(build(delim, o, a));
	}
	private static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.toString().trim();
	}
	private static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = java.lang.reflect.Array.getLength(o);
			for (int i : rep(L))
				append(b, java.lang.reflect.Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>)
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		else
			b.append(delim).append(o);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static void start() {
		t = millis();
	}
	private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);
	private static long t;
	private static long millis() {
		return System.currentTimeMillis();
	}
	public static void main (String[] args) {
		new C();
		exit();
	}
}