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:
//package Round102;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class HelpCaretakerGenerated {
	
	public static int[][] dp;
	public static String[][][] paths;

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		dp = new int[10][10];
		paths = new String[10][10][];
		
		dp[3][3] = 1;
		paths[3][3] = new String[] {"..A",
		"AAA",
		"..A"};
		dp[3][4] = 1;
		paths[3][4] = new String[] {"..A.",
		"AAA.",
		"..A."};
		dp[3][5] = 2;
		paths[3][5] = new String[] {".A..B",
		".ABBB",
		"AAA.B"};
		dp[3][6] = 2;
		paths[3][6] = new String[] {"..A..B",
		"AAABBB",
		"..A..B"};
		dp[3][7] = 3;
		paths[3][7] = new String[] {".ABBB.C",
		".A.BCCC",
		"AAAB..C"};
		dp[3][8] = 3;
		paths[3][8] = new String[] {"..A.B..C",
		"AAA.BCCC",
		"..ABBB.C"};
		dp[3][9] = 4;
		paths[3][9] = new String[] {".ABBBC..D",
		".A.B.CDDD",
		"AAABCCC.D"};
		dp[4][4] = 2;
		paths[4][4] = new String[] {"A...",
		"AAAB",
		"ABBB",
		"...B"};
		dp[4][5] = 2;
		paths[4][5] = new String[] {"..A..",
		"AAAB.",
		"..AB.",
		"..BBB"};
		dp[4][6] = 3;
		paths[4][6] = new String[] {"..ACCC",
		"AAABC.",
		"..ABC.",
		"..BBB."};
		dp[4][7] = 4;
		paths[4][7] = new String[] {"A..CCC.",
		"AAABCD.",
		"ABBBCD.",
		"...BDDD"};
		dp[4][8] = 4;
		paths[4][8] = new String[] {"..A.C...",
		"AAABCCCD",
		"..ABCDDD",
		"..BBB..D"};
		dp[4][9] = 5;
		paths[4][9] = new String[] {"..ACCCEEE",
		"AAABC.DE.",
		"..ABC.DE.",
		"..BBBDDD."};
		dp[5][5] = 4;
		paths[5][5] = new String[] {"A.CCC",
		"AAAC.",
		"AB.CD",
		".BDDD",
		"BBB.D"};
		dp[5][6] = 4;
		paths[5][6] = new String[] {"A..C..",
		"AAACCC",
		"A.BC.D",
		"BBBDDD",
		"..B..D"};
		dp[5][7] = 5;
		paths[5][7] = new String[] {"A.CCC.E",
		"AAACEEE",
		"A.BC.DE",
		"BBBDDD.",
		"..B..D."};
		dp[5][8] = 6;
		paths[5][8] = new String[] {"A..C.EEE",
		"AAACCCE.",
		"A.BCD.EF",
		"BBB.DFFF",
		"..BDDD.F"};
		dp[5][9] = 7;
		paths[5][9] = new String[] {"A.CCC.FFF",
		"AAACEEEF.",
		"A.BCDE.FG",
		"BBB.DEGGG",
		"..BDDD..G"};
		dp[6][6] = 5;
		paths[6][6] = new String[] {"..ADDD",
		"AAACD.",
		"..ACD.",
		".BCCCE",
		".B.EEE",
		"BBB..E"};
		dp[6][7] = 6;
		paths[6][7] = new String[] {"..AB...",
		"AAABBBF",
		"..ABFFF",
		".CDDDEF",
		".C.D.E.",
		"CCCDEEE"};
		dp[6][8] = 7;
		paths[6][8] = new String[] {"..AB..F.",
		"AAABBBF.",
		"..ABEFFF",
		"C..DEEEG",
		"CCCDEGGG",
		"C.DDD..G"};
		dp[6][9] = 8;
		paths[6][9] = new String[] {"..AB..GGG",
		"AAABBBFG.",
		"..ABFFFG.",
		".CDDDEF.H",
		".C.D.EHHH",
		"CCCDEEE.H"};
		dp[7][7] = 8;
		paths[7][7] = new String[] {"A.DDD.G",
		"AAADGGG",
		"A.CDF.G",
		"CCCEFFF",
		".BCEFH.",
		".BEEEH.",
		"BBB.HHH"};
		dp[7][8] = 9;
		paths[7][8] = new String[] {"A..DDD.H",
		"AAACDHHH",
		"ACCCDG.H",
		"BBBCFGGG",
		".BE.FGI.",
		".BEFFFI.",
		".EEE.III"};
		dp[7][9] = 10;
		paths[7][9] = new String[] {".ABBB.III",
		".A.BFFFI.",
		"AAABEFHI.",
		"C.EEEFHHH",
		"CCCDEGH.J",
		"CDDD.GJJJ",
		"...DGGG.J"};
		dp[8][8] = 10;
		paths[8][8] = new String[] {"..A.BCCC",
		"AAA.B.C.",
		"..ABBBCI",
		"D.FFFIII",
		"DDDFHHHI",
		"DE.FGHJ.",
		".EGGGHJ.",
		"EEE.GJJJ"};
		dp[8][9] = 12;
		paths[8][9] = new String[] {"A.CCC.HHH",
		"AAACGGGH.",
		"AB.CFG.HK",
		".BFFFGKKK",
		"BBBEFJ..K",
		"DEEEIJJJL",
		"DDDEIJLLL",
		"D..III..L"};
		dp[9][9] = 13;
		paths[9][9] = new String[] {"..ADDDFFF",
		"AAACD.EF.",
		"..ACD.EF.",
		"B.CCCEEEL",
		"BBBIIILLL",
		"BHHHIKKKL",
		".GH.IJKM.",
		".GHJJJKM.",
		"GGG..JMMM"};
		
//		System.setIn(new FileInputStream("src/Round102/helpcaretaker.in"));
		
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		String[] parts = bf.readLine().trim().split("[ ]+");
		int rows = Integer.parseInt(parts[0]);
		int cols = Integer.parseInt(parts[1]);
		
		if(rows < 3 || cols < 3) {
			System.out.println("0");
			for(int i = 0; i < rows; i++) {
				for(int j = 0; j < cols; j++)
					System.out.print(".");
				System.out.println();
			}
			return;
		}
		
		if(rows <= cols) {
			System.out.println(dp[rows][cols]);
			printNormal(rows, cols);
		}
		else {
			System.out.println(dp[cols][rows]);
			printTurned(cols, rows);
		}
	}
	
	public static void printNormal(int i, int j) {
		for(int k = 0; k < paths[i][j].length; k++)
			System.out.println(paths[i][j][k]);
	}
	
	public static void printTurned(int i, int j) {
		for(int l = 0; l < paths[i][j][0].length(); l++) {
			for(int k = 0; k < paths[i][j].length; k++) {
				System.out.print(paths[i][j][k].charAt(l));
			}
			System.out.println();
		}
//		for(int k = 0; k < paths[i][j].length; k++) {
//			for(int l = 0; l < paths[i][j][k].length(); l++) {
//				System.out.print(paths[i][j][k].charAt(l));
//			}
//			System.out.println();
//		}
	}

}