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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
char Str[][16] = {
    "0",         "",          "0",         "",          "0",
    "",          "0",         "",          "0",         "",
    "0",         "",          "0",         "",          "0",
    "",          "0",         "",          "0",         "",
    "",          "0",         "",          "",          "0",
    "",          "",          "0",         "",          "",
    "0",         "",          "",          "0",         "",
    "",          "0",         "",          "",          "0",
    "",          "",          "0",         "",          "",
    "0",         "",          "",          "",          "0",
    "",          "",          "",          "1",         "AAA",
    ".A.",       ".A.",       "1",         "AAA.",      ".A..",
    ".A..",      "2",         "AAA.B",     ".ABBB",     ".A..B",
    "2",         "AAA.B.",    ".ABBB.",    ".A..B.",    "3",
    "AAABCCC",   ".A.B.C.",   ".ABBBC.",   "3",         "AAA.BCCC",
    ".ABBB.C.",  ".A..B.C.",  "4",         "AAABCCC.D", ".A.B.CDDD",
    ".ABBBC..D", "0",         "A",         ".",         ".",
    ".",         "0",         "A",         ".",         ".",
    ".",         "1",         "AAA",       ".A.",       ".A.",
    "...",       "2",         "AAA.",      ".AB.",      ".AB.",
    ".BBB",      "2",         "AAA.B",     ".ABBB",     ".A..B",
    ".....",     "3",         "AAABBB",    ".AC.B.",    ".AC.B.",
    ".CCC..",    "4",         "AAABBB.",   ".AC.BD.",   ".AC.BD.",
    ".CCCDDD",   "4",         "AAA.BCCC",  ".ABBBDC.",  ".A..BDC.",
    "....DDD.",  "5",         "AAABBBCCC", ".AD.BE.C.", ".AD.BE.C.",
    ".DDDEEE..", "0",         "A",         ".",         ".",
    ".",         ".",         "0",         "A",         ".",
    ".",         ".",         ".",         "2",         "AAA",
    ".A.",       "BA.",       "BBB",       "B..",       "2",
    "AAA.",      ".AB.",      ".AB.",      ".BBB",      "....",
    "4",         "AAA.B",     ".ABBB",     "CA.DB",     "CCCD.",
    "C.DDD",     "4",         "AAA.B.",    ".ABBB.",    "CA.DB.",
    "CCCD..",    "C.DDD.",    "5",         "AAA.B..",   ".ABBBC.",
    "DA.EBC.",   "DDDECCC",   "D.EEE..",   "6",         "AAA.BCCC",
    ".ABBBDC.",  "EA.FBDC.",  "EEEFDDD.",  "E.FFF...",  "7",
    "AAA.BCCC.", ".ABBBDC..", "EA.FBDCG.", "EEEFDDDG.", "E.FFF.GGG",
    "0",         "A",         ".",         "E",         "E",
    "E",         ".",         "0",         "A",         ".",
    "E",         "E",         "E",         ".",         "2",
    "AAA",       ".A.",       "BA.",       "BBB",       "B..",
    "...",       "3",         "AAA.",      ".AB.",      ".AB.",
    "CBBB",      "CCC.",      "C...",      "4",         "AAA.B",
    ".ABBB",     "CA.DB",     "CCCD.",     "C.DDD",     ".....",
    "5",         "AAA.B.",    ".ABBB.",    ".A.CB.",    "DCCCE.",
    "DDDCE.",    "D..EEE",    "6",         "AAABCCC",   ".A.B.C.",
    "DABBBCE",   "DDDFEEE",   "DFFF..E",   "...F...",   "7",
    "AAA.BCCC",  ".ABBBDC.",  "EA.FBDC.",  "EEEFDDDG",  "E.FFFGGG",
    ".......G",  "8",         "AAA.BCCC.", ".ABBB.C..", ".A.DBEC..",
    "FDDDGEEEH", "FFFDGEHHH", "F..GGG..H", "0",         "A",
    ".",         ".",         "F",         "F",         "F",
    ".",         "0",         "A",         ".",         ".",
    "F",         "F",         "F",         ".",         "3",
    "AAA",       ".A.",       "BA.",       "BBB",       "B.C",
    "CCC",       "..C",       "4",         "AAA.",      ".AB.",
    ".AB.",      "CBBB",      "CCCD",      "CDDD",      "...D",
    "5",         "AAA.B",     ".ABBB",     "CA.DB",     "CCCD.",
    "CEDDD",     ".E...",     "EEE..",     "6",         "AAA.B.",
    ".ABBB.",    "CA.DB.",    "CCCD..",    "CEDDDF",    ".E.FFF",
    "EEE..F",    "8",         "AAABCCC",   ".A.B.C.",   "DABBBCE",
    "DDDFEEE",   "DG.F.HE",   ".GFFFH.",   "GGG.HHH",   "9",
    "AAA.BBB.",  ".ACCCBD.",  ".AEC.BD.",  "EEECFDDD",  "G.EHFFFI",
    "GGGHFIII",  "G.HHH..I",  "10",        "AAA.BC...", ".ABBBCCCD",
    "EA.FBCDDD", "EEEF.GGGD", "EHFFFIGJ.", ".H.IIIGJ.", "HHH..IJJJ",
    "0",         "A",         ".",         "E",         "E",
    "E",         ".",         "H",         ".",         "0",
    "A",         ".",         "E",         "E",         "E",
    ".",         "H",         ".",         "3",         "AAA",
    ".A.",       "BA.",       "BBB",       "B.C",       "CCC",
    "..C",       "...",       "4",         "AAA.",      ".AB.",
    ".AB.",      "CBBB",      "CCCD",      "CDDD",      "...D",
    "....",      "6",         "AAA.B",     ".ABBB",     "CA.DB",
    "CCCD.",     "CEDDD",     ".EFFF",     "EEEF.",     "...F.",
    "7",         "AAA.B.",    ".ABBB.",    "CA.DB.",    "CCCDDD",
    "C.ED..",    ".FEEEG",    ".FEGGG",    "FFF..G",    "9",
    "AAAB..C",   ".A.BCCC",   "DABBBEC",   "DDDEEE.",   "DFFF.EG",
    ".HFIGGG",   ".HFIIIG",   "HHHI...",   "10",        "AAA.BCCC",
    ".ABBBDC.",  "EA.FBDC.",  "EEEFDDDG",  "EHFFFGGG",  ".HIII.JG",
    "HHHIJJJ.",  "...I..J.",  "12",        "AAABBB..C", ".AD.BECCC",
    ".AD.BEEEC", "FDDDGEHHH", "FFFIGGGH.", "FJ.IGK.HL", ".JIIIKLLL",
    "JJJ.KKK.L", "0",         "A",         ".",         ".",
    "F",         "F",         "F",         ".",         "J",
    ".",         "0",         "A",         ".",         ".",
    "F",         "F",         "F",         ".",         "J",
    ".",         "4",         "AAA",       ".A.",       "BA.",
    "BBB",       "B.C",       "CCC",       "D.C",       "DDD",
    "D..",       "5",         "AAA.",      ".AB.",      ".AB.",
    "CBBB",      "CCCD",      "CDDD",      "EEED",      ".E..",
    ".E..",      "7",         "AAA.B",     ".ABBB",     "CA.DB",
    "CCCD.",     "CEDDD",     ".EEEF",     "GEFFF",     "GGG.F",
    "G....",     "8",         "AAA.B.",    ".ABBB.",    "CA.DB.",
    "CCCDDD",    "C.ED.F",    "EEEFFF",    "G.EH.F",    "GGGH..",
    "G.HHH.",    "10",        "AAA.B..",   ".ABBBC.",   "DA.EBC.",
    "DDDECCC",   "DFEEE.G",   ".FFFGGG",   "HFIIIJG",   "HHHI.J.",
    "H..IJJJ",   "12",        "AAA.BCCC",  ".ABBBDC.",  "EA.FBDC.",
    "EEEFDDDG",  "EHFFFGGG",  ".HHHIIIG",  "JHKKKIL.",  "JJJK.IL.",
    "J..K.LLL",  "13",        "AAA.BCCC.", ".ABBB.CD.", "EA.FB.CD.",
    "EEEF.GDDD", "EHFFFGIII", ".HHHGGGI.", "JHKKKL.IM", "JJJK.LMMM",
    "J..KLLL.M"};
int Id[] = {0,   2,   4,   6,   8,   10,  12,  14,  16,  18,  21,  24,
            27,  30,  33,  36,  39,  42,  45,  49,  53,  57,  61,  65,
            69,  73,  77,  81,  86,  91,  96,  101, 106, 111, 116, 121,
            126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 187, 194,
            201, 208, 215, 222, 229, 236, 243, 251, 259, 267, 275, 283,
            291, 299, 307, 315, 324, 333, 342, 351, 360, 369, 378, 387,
            396, 406, 416, 426, 436, 446, 456, 466, 476};
int main() {
  for (int N, M; scanf("%d%d", &N, &M) != EOF && N;) {
    int d = (N - 1) * 9 + M - 1;
    int x = Id[d];
    puts(Str[x]);
    if (Str[x][0] == '0') {
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) putchar('.');
        putchar('\n');
      }
    } else {
      ++x;
      for (int i = 0; i < N; i++) puts(Str[x + i]);
    }
  }
  return 0;
}