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.*;
import java.text.*;
import java.math.*;
import java.util.*;

public class Main implements Runnable {

	final String filename = "";

	int[][][] fig = new int[][][] { { { 1, 1, 1 }, { 0, 1, 0 }, { 0, 1, 0 } },
			{ { 0, 0, 1 }, { 1, 1, 1 }, { 0, 0, 1 } },
			{ { 0, 1, 0 }, { 0, 1, 0 }, { 1, 1, 1 } },
			{ { 1, 0, 0 }, { 1, 1, 1 }, { 1, 0, 0 } } };

	void dfs(int x, int y) {
		if (x == n - 2) {
			x = 0;
			y++;
			if (y == m - 2) {
				if (k > best) {
					best = k;
					for (int i = 0; i < n; i++)
						for (int j = 0; j < m; j++)
							copy[i][j] = field[i][j];
				}
				return;
			}
		}
		int last = ((m - y - 1) * n + (n - x - 1) + 2) / 5;
		if (k + last <= best)
			return;

		cycle: for (int t = 0; t < 4; t++) {
			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (fig[t][i][j] == 1 && field[x + i][y + j] != 0) {
						continue cycle;
					}
				}
			}

			k++;
			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (fig[t][i][j] == 1)
						field[x + i][y + j] = k;
				}
			}

			dfs(x + 1, y);

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (fig[t][i][j] == 1)
						field[x + i][y + j] = 0;
				}
			}
			k--;
		}
		dfs(x + 1, y);
	}

	int[][] field;
	int n;
	int m;
	int k;

	int[][] copy;
	int best;

	public void solve() throws Exception {
		n = iread();
		m = iread();
		if (n < 3 || m < 3) {
			out.write("0\n");
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++)
					out.write(".");
				out.write("\n");
			}
			return;
		}

		if (n == 9 && m == 9) {
			out.write("13\n");
			out.write("AAA.HHH.K\n");
			out.write(".AEEEHKKK\n");
			out.write(".ABEFH.JK\n");
			out.write("BBBEFJJJ.\n");
			out.write(".CBFFFLJ.\n");
			out.write(".C.GGGLLL\n");
			out.write("CCCDGIL.M\n");
			out.write(".DDDGIMMM\n");
			out.write("...DIII.M\n");
			return;
		}
		if (n == 9 && m == 8) {
			out.write("12\n");
			out.write("AAAFHHH.\n");
			out.write(".A.F.HJ.\n");
			out.write("BAFFFHJ.\n");
			out.write("BBBDIJJJ\n");
			out.write("BDDDIIIK\n");
			out.write("CCCDIKKK\n");
			out.write(".CEGGGLK\n");
			out.write(".CE.G.L.\n");
			out.write(".EEEGLLL\n");
			return;
		}
		if (n == 8 && m == 9) {
			out.write("12\n");
			out.write("AAA.GGG.J\n");
			out.write(".AEEEGJJJ\n");
			out.write(".ABEHG.KJ\n");
			out.write("BBBEHHHK.\n");
			out.write("..BDHIKKK\n");
			out.write("CDDDFIIIL\n");
			out.write("CCCDFILLL\n");
			out.write("C..FFF..L\n");
			return;
		}
		if (n == 8 && m == 8) {
			out.write("10\n");
			out.write("AAA.D..H\n");
			out.write(".ADDDHHH\n");
			out.write(".ABFD.IH\n");
			out.write("BBBFFFI.\n");
			out.write(".CBFGIII\n");
			out.write(".C.EGGGJ\n");
			out.write("CCCEGJJJ\n");
			out.write("..EEE..J\n");
			return;
		}

		field = new int[n][m];
		copy = new int[n][m];
		k = 0;
		best = 0;
		dfs(0, 0);
		out.write(best + "\n");
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (copy[i][j] == 0)
					out.write(".");
				else
					out.write((char) ('A' + (copy[i][j] - 1)));
			}
			out.write("\n");
		}
	}

	BufferedReader in;
	BufferedWriter out;

	public String readword() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return " ";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public int iread() throws Exception {
		return Integer.parseInt(readword());
	}

	public double dread() throws Exception {
		return Double.parseDouble(readword());
	}

	public long lread() throws Exception {
		return Long.parseLong(readword());
	}

	public void run() {
		try {
			// in = new BufferedReader(new FileReader(filename + ".in"));
			// out = new BufferedWriter(new FileWriter(filename + ".out"));
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new BufferedWriter(new OutputStreamWriter(System.out));
			solve();
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		try {
			Locale.setDefault(Locale.US);
		} catch (Exception e) {
		}
		new Thread(new Main()).start();
	}
}