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;
string aa[] = {
    "1 1",       "0",         ".",         "1 2",       "0",
    "..",        "1 3",       "0",         "...",       "1 4",
    "0",         "....",      "1 5",       "0",         ".....",
    "1 6",       "0",         "......",    "1 7",       "0",
    ".......",   "1 8",       "0",         "........",  "1 9",
    "0",         ".........", "2 1",       "0",         ".",
    ".",         "2 2",       "0",         "..",        "..",
    "2 3",       "0",         "...",       "...",       "2 4",
    "0",         "....",      "....",      "2 5",       "0",
    ".....",     ".....",     "2 6",       "0",         "......",
    "......",    "2 7",       "0",         ".......",   ".......",
    "2 8",       "0",         "........",  "........",  "2 9",
    "0",         ".........", ".........", "3 1",       "0",
    ".",         ".",         ".",         "3 2",       "0",
    "..",        "..",        "..",        "3 3",       "1",
    "AAA",       ".A.",       ".A.",       "3 4",       "1",
    "A...",      "AAA.",      "A...",      "3 5",       "2",
    "B..A.",     "BBBA.",     "B.AAA",     "3 6",       "2",
    "B..A..",    "BBBA..",    "B.AAA.",    "3 7",       "3",
    "C..B..A",   "CCCBAAA",   "C.BBB.A",   "3 8",       "3",
    "C..B..A.",  "CCCBAAA.",  "C.BBB.A.",  "3 9",       "4",
    "D..CBBBA.", "DDDC.B.A.", "D.CCCBAAA", "4 1",       "0",
    ".",         ".",         ".",         ".",         "4 2",
    "0",         "..",        "..",        "..",        "..",
    "4 3",       "1",         "AAA",       ".A.",       ".A.",
    "...",       "4 4",       "2",         "BBB.",      ".BA.",
    ".BA.",      ".AAA",      "4 5",       "2",         "B....",
    "BBBA.",     "BAAA.",     "...A.",     "4 6",       "3",
    "C..AAA",    "CCCBA.",    "CBBBA.",    "...B..",    "4 7",
    "4",         "D..BBB.",   "DDDCBA.",   "DCCCBA.",   "...CAAA",
    "4 8",       "4",         "D..BBB..",  "DDDCBA..",  "DCCCBA..",
    "...CAAA.",  "4 9",       "5",         "E..CCCA..", "EEEDCBAAA",
    "EDDDCBA..", "...DBBB..", "5 1",       "0",         ".",
    ".",         ".",         ".",         ".",         "5 2",
    "0",         "..",        "..",        "..",        "..",
    "..",        "5 3",       "2",         "BBB",       ".B.",
    ".BA",       "AAA",       "..A",       "5 4",       "2",
    "BBB.",      ".BA.",      ".BA.",      ".AAA",      "....",
    "5 5",       "4",         "DDD.C",     ".DCCC",     "BD.AC",
    "BBBA.",     "B.AAA",     "5 6",       "4",         "D..B..",
    "DDDB..",    "DCBBBA",    ".C.AAA",    "CCC..A",    "5 7",
    "5",         "E..C..A",   "EEECAAA",   "EDCCCBA",   ".D.BBB.",
    "DDD..B.",   "5 8",       "6",         "F.DDD.B.",  "FFFDBBB.",
    "FE.DCAB.",  ".ECCCAAA",  "EEE.CA..",  "5 9",       "7",
    "G.EEE.AAA", "GGGECCCA.", "GF.EDCBA.", ".FDDDCB..", "FFF.DBBB.",
    "6 1",       "0",         ".",         ".",         ".",
    ".",         ".",         ".",         "6 2",       "0",
    "..",        "..",        "..",        "..",        "..",
    "..",        "6 3",       "2",         "BBB",       ".B.",
    ".BA",       "AAA",       "..A",       "...",       "6 4",
    "3",         "CCC.",      ".CB.",      ".CB.",      "ABBB",
    "AAA.",      "A...",      "6 5",       "4",         "DDD.C",
    ".DCCC",     ".DB.C",     "BBBA.",     "..BA.",     "..AAA",
    "6 6",       "5",         "EEE.D.",    ".EDDD.",    ".E.CD.",
    "BCCCA.",    "BBBCA.",    "B..AAA",    "6 7",       "6",
    "F..D..B",   "FFFDBBB",   "FEDDDAB",   ".E.C.A.",   "EEECAAA",
    "..CCC..",   "6 8",       "7",         "G..E.BBB",  "GGGE.CB.",
    "GFEEECB.",  ".F.DCCCA",  "FFFD.AAA",  "..DDD..A",  "6 9",
    "8",         "H..FDDD.B", "HHHF.DBBB", "HGFFFDC.B", ".G.ECCCA.",
    "GGGE..CA.", "..EEE.AAA", "7 1",       "0",         ".",
    ".",         ".",         ".",         ".",         ".",
    ".",         "7 2",       "0",         "..",        "..",
    "..",        "..",        "..",        "..",        "..",
    "7 3",       "3",         "CCC",       ".C.",       ".CB",
    "BBB",       ".AB",       ".A.",       "AAA",       "7 4",
    "4",         "DDD.",      ".DC.",      ".DC.",      "BCCC",
    "BBBA",      "BAAA",      "...A",      "7 5",       "5",
    "EEE.D",     ".EDDD",     ".EC.D",     "CCCB.",     ".ACB.",
    ".ABBB",     "AAA..",     "7 6",       "6",         "FFF.E.",
    ".FEEE.",    ".FD.EC",    "DDDCCC",    ".BD.AC",    ".BAAA.",
    "BBB.A.",    "7 7",       "8",         "HHHGFFF",   ".H.G.F.",
    "EHGGGFD",   "EEECDDD",   "EB.C.AD",   ".BCCCA.",   "BBB.AAA",
    "7 8",       "9",         "I.FFF..B",  "IIIFDBBB",  "I.HFDDDB",
    "HHHEDAAA",  ".GHE.CA.",  ".GEEECA.",  "GGG.CCC.",  "7 9",
    "10",        "J..GEEE.C", "JJJG.ECCC", "JIGGGEB.C", ".I.FFFBBB",
    "IIIHFDB.A", ".HHHFDAAA", "...HDDD.A", "8 1",       "0",
    ".",         ".",         ".",         ".",         ".",
    ".",         ".",         ".",         "8 2",       "0",
    "..",        "..",        "..",        "..",        "..",
    "..",        "..",        "..",        "8 3",       "3",
    "CCC",       ".C.",       ".CB",       "BBB",       ".AB",
    ".A.",       "AAA",       "...",       "8 4",       "4",
    "DDD.",      ".DC.",      ".DC.",      "BCCC",      "BBBA",
    "BAAA",      "...A",      "....",      "8 5",       "6",
    "FFF.E",     ".FEEE",     "DF.CE",     "DDDC.",     "DBCCC",
    ".BAAA",     "BBBA.",     "...A.",     "8 6",       "7",
    "GGG.F.",    ".GFFF.",    ".GE.FD",    "EEEDDD",    "..EC.D",
    "BCCCA.",    "BBBCA.",    "B..AAA",    "8 7",       "9",
    "IIIH..G",   ".I.HGGG",   "FIHHHEG",   "FFFEEE.",   "FDDD.EC",
    ".BDACCC",   ".BDAAAC",   "BBBA...",   "8 8",       "10",
    "JJJ.IHHH",  ".JIIIGH.",  "FJ.EIGH.",  "FFFEGGGD",  "FCEEEDDD",
    ".CBBB.AD",  "CCCBAAA.",  "...B..A.",  "8 9",       "12",
    "L.HHH.CCC", "LLLHEEEC.", "LK.HGEBC.", ".KGGGEBBB", "KKKIGDB..",
    "JIIIFDDDA", "JJJIFDAAA", "J..FFF..A", "9 1",       "0",
    ".",         ".",         ".",         ".",         ".",
    ".",         ".",         ".",         ".",         "9 2",
    "0",         "..",        "..",        "..",        "..",
    "..",        "..",        "..",        "..",        "..",
    "9 3",       "4",         "DDD",       ".D.",       ".DC",
    "CCC",       "B.C",       "BBB",       "B.A",       "AAA",
    "..A",       "9 4",       "5",         "EEE.",      ".ED.",
    ".ED.",      "CDDD",      "CCCB",      "CBBB",      "AAAB",
    ".A..",      ".A..",      "9 5",       "7",         "GGG.F",
    ".GFFF",     "EG.DF",     "EEED.",     "ECDDD",     ".CCCB",
    "ACBBB",     "AAA.B",     "A....",     "9 6",       "8",
    "HHH.G.",    ".HGGG.",    ".HF.GE",    "FFFEEE",    "D.FC.E",
    "DDDC..",    "DBCCCA",    ".B.AAA",    "BBB..A",    "9 7",
    "10",        "JJJ.I..",   ".JIIIH.",   ".JG.IH.",   "GGGFHHH",
    "E.GFFFD",   "EEEFDDD",   "ECBBBAD",   ".C.B.A.",   "CCCBAAA",
    "9 8",       "12",        "LLL.KJJJ",  ".LKKKIJ.",  "HL.GKIJ.",
    "HHHGIIIF",  "HEGGGFFF",  ".EEEDDDF",  "CEBBBDA.",  "CCCB.DA.",
    "C..B.AAA",  "9 9",       "13",        "MMM.LKKK.", ".MLLL.KJ.",
    ".MI.LHKJ.", "IIIHHHJJJ", "G.I.FHEEE", "GGGDFFFE.", "GC.DFB.EA",
    ".CDDDBAAA", "CCC.BBB.A",
};
int main() {
  int n, m;
  cin >> n >> m;
  int p = 0;
  for (int i = 1; i <= 9; ++i)
    for (int j = 1; j <= 9; ++j) {
      if (i == n && j == m) {
        cout << aa[++p] << endl;
        for (int k = 0; k < n; ++k) cout << aa[++p] << endl;
      } else {
        p += 2 + i;
      }
    }
}