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 static java.util.Arrays.deepToString;

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

public class C {
	static int n, m;
	static int best = -1;
	static char[][] ans;

	static int[][] fx = new int[][] { new int[] { 0, 1, 2, 1, 1 }, new int[] { 2, 0, 1, 2, 2 },
			new int[] { 1, 1, 0, 1, 2 }, new int[] { 0, 0, 1, 2, 0 } };

	static int[][] fy = new int[][] { new int[] { 0, 0, 0, 1, 2 }, new int[] { 0, 1, 1, 1, 2 },
			new int[] { 0, 1, 2, 2, 2 }, new int[] { 0, 1, 1, 1, 2 } };

	static void go(char[][] b, int have, int mf, int mi, int mj) {
		if (have > best) {
			best = have;
			for (int i = 0; i < n; i++) {
				ans[i] = Arrays.copyOf(b[i], m);
			}
		}
		char c = (char) ('A' + have);
		for (int i = mi; i < n - 2; i++) {
			int stj = (i == mi) ? mj : 0;
			outer2: for (int j = stj; j < m - 2; j++) {
				if (b[i + 1][j + 1] != '.')
					continue outer2;
				int stf = (j == mj && i == mi) ? mf : 0;
				outer: for (int f = stf; f < 4; f++) {
					for (int t = 0; t < 5; t++) {
						int ny = i + fy[f][t];
						int nx = j + fx[f][t];
						if (b[ny][nx] != '.')
							continue outer;
					}
					for (int t = 0; t < 5; t++) {
						int ny = i + fy[f][t];
						int nx = j + fx[f][t];
						b[ny][nx] = c;
					}
					go(b, have + 1, f, i, j);
					for (int t = 0; t < 5; t++) {
						int ny = i + fy[f][t];
						int nx = j + fx[f][t];
						b[ny][nx] = '.';
					}
				}
			}
		}
	}

	static void solve(int N, int M) {
		n = N;
		m = M;
		char[][] b = new char[n][m];
		for (char[] br : b) {
			Arrays.fill(br, '.');
		}
		best = -1;
		ans = new char[n][];
		go(b, 0, 0, 0, 0);
	}

	static String[] res = new String[] { ".", "..", "...", "....", ".....", "......", ".......", "........",
			".........", "..", "....", "......", "........", "..........", "............", "..............",
			"................", "..................", "...", "......", "AAA.A..A.", "AAA..A...A..", "AAA.B.ABBB.A..B",
			"AAA.B..ABBB..A..B.", "AAABCCC.A.B.C..ABBBC.", "AAA.BCCC.ABBB.C..A..B.C.", "AAABCCC.D.A.B.CDDD.ABBBC..D",
			"....", "........", "AAA.A..A....", "AAA..AB..AB..BBB", "AAA.B.ABBB.A..B.....", "AAABBB.AC.B..AC.B..CCC..",
			"AAABBB..AC.BD..AC.BD..CCCDDD", "AAA.BCCC.ABBBDC..A..BDC.....DDD.", "AAABBBCCC.AD.BE.C..AD.BE.C..DDDEEE..",
			".....", "..........", "AAA.A..ABBBB..B", "AAA..AB..AB..BBB....", "AAA.B.ABBBCA.DBCCCD.C.DDD",
			"AAA.B..ABBB..AC.BDCCCDDD..C..D", "AAA.B...ABBBC.DA.EBC.DDDECCCD.EEE..",
			"AAA.BCCC.ABBBDC.EA.FBDC.EEEFDDD.E.FFF...", "AAA.BCCC..ABBBDC..EA.FBDCG.EEEFDDDG.E.FFF.GGG", "......",
			"............", "AAA.A..ABBBB..B...", "AAA..AB..AB.CBBBCCC.C...", "AAA.B.ABBB.AC.BCCCD...CD...DDD",
			"AAA.B..ABBB..A.CB.DCCCE.DDDCE.D..EEE", "AAABCCC.A.B.C.DABBBCEDDDFEEEDFFF..E...F...",
			"AAA.BCCC.ABBBDC..AE.BDC.EEEFDDDG..EF.GGG..FFF..G",
			"AAA.BCCC..ABBB.C...A.DBEC..FDDDGEEEHFFFDGEHHHF..GGG..H", ".......", "..............",
			"AAA.A..ABBBB.CB.C.CCC", "AAA..AB..AB.CBBBCCCDCDDD...D", "AAA.B.ABBB.AC.BCCCD..ECD..EDDDEEE..",
			"AAA.B..ABBB..AC.BDCCCDDD.EC.FD.EFFF.EEE.F.", "AAABCCC.A.B.C.DABBBCEDDDFEEEDG.F.HE.GFFFH.GGG.HHH",
			"AAA.BBB..ACCCBD..AEC.BD.EEECFDDDG.EHFFFIGGGHFIIIG.HHH..I",
			"AAA.BC....ABBBCCCDEA.FBCDDDEEEF.GGGDEHFFFIGJ..H.IIIGJ.HHH..IJJJ", "........", "................",
			"AAA.A..ABBBB.CB.C.CCC...", "AAA..AB..AB.CBBBCCCDCDDD...D....", "AAA.B.ABBBCA.DBCCCD.CEDDD.EFFFEEEF....F.",
			"AAA.B..ABBB..AC.BDCCCDDD..CE.DFEEEG.FFFEG.F..GGG",
			"AAAB..C.A.BCCCDABBBECDDDEEE.DFFF.EG.HFIGGG.HFIIIGHHHI...",
			"AAA.BCCC.ABBBDC.EA.FBDC.EEEFDDDGEHFFFGGG.HIII.JGHHHIJJJ....I..J.",
			"AAABBB..C.AD.BECCC.AD.BEEECFDDDGEHHHFFFIGGGH.FJ.IGK.HL.JIIIKLLLJJJ.KKK.L", ".........",
			"..................", "AAA.A..ABBBBC.BCCCC.DDDD..D", "AAA..AB..AB.CBBBCCCDCDDDEEED.E...E..",
			"AAA.B.ABBBCA.DBCCCD.CEDDD.EEEFGEFFFGGG.FG....", "AAA.B..ABBB..AC.BDCCCDDDE.CF.DEEEF..EGFFFH.G.HHHGGG..H",
			"AAA.B...ABBBC..AD.BC.DDDECCCF.DEEEGFFFEGGGFHIIIJG.H.I.J.HHHIJJJ",
			"AAA.BCCC.ABBBDC.EA.FBDC.EEEFDDDGEHFFFGGG.HHHIIIGJHKKKIL.JJJK.IL.J..K.LLL",
			"AAA.BCCC..ABBB.CD..AE.BFCD.EEEFFFDDDG.E.HFIIIGGGJHHHI.GK.JHL.IM.KJJJLMMMKKK.LLL.M" };

	static void solve2(int n, int m) {
		String w = res[(n - 1) * 9 + (m - 1)];
		ans = new char[n][m];
		int filled = 0;
//		debug(w);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				ans[i][j] = w.charAt(i * m + j);
				if (ans[i][j] != '.')
					filled++;
			}
		}
		best = filled / 5;
	}

	public static void main(String[] args) throws Exception {
		reader = new BufferedReader(new InputStreamReader(System.in));
		writer = new PrintWriter(System.out);

		// PrintWriter writer2 = new PrintWriter("out.txt");
		//
		// writer2.print("String [] res = new String [] {");
		// for (int n = 1; n <= 9; n++) {
		// for (int m = 1; m <= 9; m++) {
		// debug(n, m);
		// solve(n, m);
		// String str = "";
		// for (int i = 0; i < n; i++) {
		// for (int j = 0; j < m; j++) {
		// str += ans[i][j];
		// }
		// }
		// writer2.print("\"" + str + "\", ");
		// }
		// }
		// writer2.close();
		// debug("done");

		setTime();
		int n = nextInt(), m = nextInt();
		solve2(n, m);
		writer.println(best);
		for (char[] ansR : ans) {
			writer.println(new String(ansR));
		}
		printTime();
		printMemory();

		writer.close();
	}

	static BufferedReader reader;
	static PrintWriter writer;
	static StringTokenizer tok = new StringTokenizer("");
	static long systemTime;

	static void debug(Object... o) {
		System.err.println(deepToString(o));
	}

	static void setTime() {
		systemTime = System.currentTimeMillis();
	}

	static void printTime() {
		System.err.println("Time consumed: " + (System.currentTimeMillis() - systemTime));
	}

	static void printMemory() {
		System.err.println("Memory consumed: "
				+ (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 + "kb");
	}

	static String next() {
		while (!tok.hasMoreTokens()) {
			String w = null;
			try {
				w = reader.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			if (w == null)
				return null;
			tok = new StringTokenizer(w);
		}
		return tok.nextToken();
	}

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

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

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

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