Problem: Autumn came late to the kingdom of Far Far Away. The harvest was exuberant and it is now time to get ready for the winter. As most people celebrate the Harvest festival, Simon the Caretaker tries to solve a very non-trivial task of how to find place for the agricultural equipment in the warehouse.

He's got problems with some particularly large piece of equipment, which is, of course, turboplows. The problem is that when a turboplow is stored, it takes up not some simply rectangular space. It takes up a T-shaped space like on one of the four pictures below (here character "#" stands for the space occupied by the turboplow and character "." stands for the free space):
    
    
    ###      ..#      .#.      #..  
    .#.      ###      .#.      ###  
    .#.      ..#      ###      #..  
    

Simon faced a quite natural challenge: placing in the given n × m cells warehouse the maximum number of turboplows. As one stores the turboplows, he can rotate them in any manner (so that they take up the space like on one of the four pictures above). However, two turboplows cannot "overlap", that is, they cannot share the same cell in the warehouse.

Simon feels that he alone cannot find the optimal way of positioning the plugs in the warehouse that would maximize their quantity. Can you help him?

Input

The only line contains two space-separated integers n and m — the sizes of the warehouse (1 ≤ n, m ≤ 9).

Output

In the first line print the maximum number of turboplows that can be positioned in the warehouse. In each of the next n lines print m characters. Use "." (dot) to mark empty space and use successive capital Latin letters ("A" for the first turboplow, "B" for the second one and so on until you reach the number of turboplows in your scheme) to mark place for the corresponding turboplows considering that they are positioned in the optimal manner in the warehouse. The order in which you number places for the turboplows does not matter. If there are several optimal solutions for a warehouse of the given size, print any of them.

Examples

Input

3 3


Output

1
AAA
.A.
.A.


Input

5 6


Output

4
A..C..
AAAC..
ABCCCD
.B.DDD
BBB..D


Input

2 2


Output

0
..
..

Solution (in JAVA):

Solution:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Scanner;

public class B {
	public static void main(String[] args) {
		MScanner sc = new MScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int M = sc.nextInt();
		String S = "3 3 1  AAA  .A.  .A.  3 4 1  AAA.  .A..  .A..  3 5 2  AAA.B  .ABBB  .A..B  3 6 2  AAA.B.  .ABBB.  .A..B.  3 7 3  AAABCCC  .A.B.C.  .ABBBC.  3 8 3  AAA.BCCC  .ABBB.C.  .A..B.C.  3 9 4  AAABCCC.D  .A.B.CDDD  .ABBBC..D  4 3 1  AAA  .A.  .A.  ...  4 4 2  AAA.  .AB.  .AB.  .BBB  4 5 2  AAA.B  .ABBB  .A..B  .....  4 6 3  AAABBB  .AC.B.  .AC.B.  .CCC..  4 7 4  AAABBB.  .AC.BD.  .AC.BD.  .CCCDDD  4 8 4  AAA.BCCC  .ABBBDC.  .A..BDC.  ....DDD.  4 9 5  AAABBBCCC  .AD.BE.C.  .AD.BE.C.  .DDDEEE..  5 3 2  AAA  .A.  .AB  BBB  ..B  5 4 2  AAA.  .AB.  .AB.  .BBB  ....  5 5 4  AAA.B  .ABBB  CA.DB  CCCD.  C.DDD  5 6 4  AAA.B.  .ABBB.  .AC.BD  CCCDDD  ..C..D  5 7 5  AAA.B..  .ABBBC.  DA.EBC.  DDDECCC  D.EEE..  5 8 6  AAA.BCCC  .ABBBDC.  EA.FBDC.  EEEFDDD.  E.FFF...  5 9 7  AAA.BCCC.  .ABBBDC..  EA.FBDCG.  EEEFDDDG.  E.FFF.GGG  6 3 2  AAA  .A.  .AB  BBB  ..B  ...  6 4 3  AAA.  .AB.  .AB.  CBBB  CCC.  C...  6 5 4  AAA.B  .ABBB  .AC.B  CCCD.  ..CD.  ..DDD  6 6 5  AAA.B.  .ABBB.  .A.CB.  DCCCE.  DDDCE.  D..EEE  6 7 6  AAABCCC  .A.B.C.  DABBBCE  DDDFEEE  DFFF..E  ...F...  6 8 7  AAA.BCCC  .ABBBDC.  .AE.BDC.  EEEFDDDG  ..EF.GGG  ..FFF..G  6 9 8  AAA.BCCC.  .ABBB.C..  .A.DBEC..  FDDDGEEEH  FFFDGEHHH  F..GGG..H  7 3 3  AAA  .A.  .AB  BBB  .CB  .C.  CCC  7 4 4  AAA.  .AB.  .AB.  CBBB  CCCD  CDDD  ...D  7 5 5  AAA.B  .ABBB  .AC.B  CCCD.  .ECD.  .EDDD  EEE..  7 6 6  AAA.B.  .ABBB.  .AC.BD  CCCDDD  .EC.FD  .EFFF.  EEE.F.  7 7 8  AAABCCC  .A.B.C.  DABBBCE  DDDFEEE  DG.F.HE  .GFFFH.  GGG.HHH  7 8 9  A.DDD..H  AAADFHHH  A.BDFFFH  BBBEFIII  .CBE.GI.  .CEEEGI.  CCC.GGG.  7 9 10  AAA.BC...  .ABBBCCCD  EA.FBCDDD  EEEF.GGGD  EHFFFIGJ.  .H.IIIGJ.  HHH..IJJJ  8 3 3  AAA  .A.  .AB  BBB  .CB  .C.  CCC  ...  8 4 4  AAA.  .AB.  .AB.  CBBB  CCCD  CDDD  ...D  ....  8 5 6  AAA.B  .ABBB  CA.DB  CCCD.  CEDDD  .EFFF  EEEF.  ...F.  8 6 7  AAA.B.  .ABBB.  .AC.BD  CCCDDD  ..CE.D  FEEEG.  FFFEG.  F..GGG  8 7 9  AAAB..C  .A.BCCC  DABBBEC  DDDEEE.  DFFF.EG  .HFIGGG  .HFIIIG  HHHI...  8 8 10  AAA.BCCC  .ABBBDC.  EA.FBDC.  EEEFDDDG  EHFFFGGG  .HIII.JG  HHHIJJJ.  ...I..J.  8 9 12  A.EEE.JJJ  AAAEHHHJ.  AB.EFHKJ.  .BFFFHKKK  BBBDFIK..  CDDDGIIIL  CCCDGILLL  C..GGG..L  9 3 4  AAA  .A.  .AB  BBB  C.B  CCC  C.D  DDD  ..D  9 4 5  AAA.  .AB.  .AB.  CBBB  CCCD  CDDD  EEED  .E..  .E..  9 5 7  AAA.B  .ABBB  CA.DB  CCCD.  CEDDD  .EEEF  GEFFF  GGG.F  G....  9 6 8  AAA.B.  .ABBB.  .AC.BD  CCCDDD  E.CF.D  EEEF..  EGFFFH  .G.HHH  GGG..H  9 7 10  AAA.B..  .ABBBC.  .AD.BC.  DDDECCC  F.DEEEG  FFFEGGG  FHIIIJG  .H.I.J.  HHHIJJJ  9 8 12  AAA.BCCC  .ABBBDC.  EA.FBDC.  EEEFDDDG  EHFFFGGG  .HHHIIIG  JHKKKIL.  JJJK.IL.  J..K.LLL  9 9 13  AAA.BCCC.  .ABBB.CD.  .AE.BFCD.  EEEFFFDDD  G.E.HFIII  GGGJHHHI.  GK.JHL.IM  .KJJJLMMM  KKK.LLL.M      ";
		Scanner two = new Scanner(S);
		while (two.hasNext()) {
			int H = two.nextInt();
			int W = two.nextInt();
			if (H == N && W == M) {
				out.println(two.nextInt());
				while (H-- > 0)
					out.println(two.next());
				out.close();
			} else {
				two.nextInt();
				while (H-- > 0)
					two.next();
			}
		}
		out.println(0);
		for (int a = 0; a < N; a++) {
			for (int b = 0; b < M; b++) {
				out.print(".");
			}
			out.println();
		}
		out.close();
	}

	static class MScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public MScanner() {
			stream = System.in;
			// stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

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

		int[] nextInt(int N) {
			int[] ret = new int[N];
			for (int a = 0; a < N; a++)
				ret[a] = nextInt();
			return ret;
		}

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

		long[] nextLong(int N) {
			long[] ret = new long[N];
			for (int a = 0; a < N; a++)
				ret[a] = nextLong();
			return ret;
		}

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

		double[] nextDouble(int N) {
			double[] ret = new double[N];
			for (int a = 0; a < N; a++)
				ret[a] = nextDouble();
			return ret;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] next(int N) {
			String[] ret = new String[N];
			for (int a = 0; a < N; a++)
				ret[a] = next();
			return ret;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}

		String[] nextLine(int N) {
			String[] ret = new String[N];
			for (int a = 0; a < N; a++)
				ret[a] = nextLine();
			return ret;
		}

	}
}