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;
int main() {
  int n, m;
  cin >> n >> m;
  if (n < 3 || m < 3) {
    cout << 0 << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << '.';
      }
      cout << "\n";
    }
    return 0;
  }
  if (n == 7 && m == 9)
    printf(
        "10\nAAA.BC...\n.ABBBCCCD\nEA.FBCDDD\nEEEF.GGGD\nEHFFFIGJ.\n.H.IIIGJ."
        "\nHHH..IJJJ");
  if (n == 8 && m == 7)
    printf(
        "9\nAAAB..C\n.A.BCCC\nDABBBEC\nDDDEEE.\nDFFF.EG\n.HFIGGG\n."
        "HFIIIG\nHHHI...");
  if (n == 3 && m == 3) printf("1\nAAA\n.A.\n.A.\n");
  if (n == 5 && m == 6) printf("4\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\n..C..D");
  if (n == 9 && m == 7)
    printf(
        "10\nAAA.B..\n.ABBBC.\n.AD.BC.\nDDDECCC\nF.DEEEG\nFFFEGGG\nFHIIIJG\n.H."
        "I.J.\nHHHIJJJ");
  if (n == 8 && m == 8)
    printf(
        "10\nAAA.BCCC\n.ABBBDC.\nEA.FBDC.\nEEEFDDDG\nEHFFFGGG\n.HIII."
        "JG\nHHHIJJJ.\n...I..J.");
  if (n == 9 && m == 8)
    printf(
        "12\nAAA.BCCC\n.ABBBDC.\nEA.FBDC.\nEEEFDDDG\nEHFFFGGG\n."
        "HHHIIIG\nJHKKKIL.\nJJJK.IL.\nJ..K.LLL");
  if (n == 8 && m == 9)
    printf(
        "12\nAAABBB..C\n.AD.BECCC\n.AD.BEEEC\nFDDDGEHHH\nFFFIGGGH.\nFJ.IGK."
        "HL\n.JIIIKLLL\nJJJ.KKK.L");
  if (n == 9 && m == 9)
    printf(
        "13\nAAA.BCCC.\n.ABBB.CD.\n.AE.BFCD.\nEEEFFFDDD\nG.E.HFIII\nGGGJHHHI."
        "\nGK.JHL.IM\n.KJJJLMMM\nKKK.LLL.M");
  if (n == 3 && m == 4) printf("1\nAAA.\n.A..\n.A..");
  if (n == 5 && m == 3) printf("2\nAAA\n.A.\n.AB\nBBB\n..B");
  if (n == 4 && m == 4) printf("2\nAAA.\n.AB.\n.AB.\n.BBB");
  if (n == 3 && m == 6) printf("2\nAAA.B.\n.ABBB.\n.A..B.");
  if (n == 5 && m == 4) printf("2\nAAA.\n.AB.\n.AB.\n.BBB\n....");
  if (n == 5 && m == 5) printf("4\nAAA.B\n.ABBB\nCA.DB\nCCCD.\nC.DDD");
  if (n == 4 && m == 3) printf("1\nAAA\n.A.\n.A.\n...");
  if (n == 3 && m == 5) printf("2\nAAA.B\n.ABBB\n.A..B");
  if (n == 6 && m == 3) printf("2\nAAA\n.A.\n.AB\nBBB\n..B\n...");
  if (n == 4 && m == 5) printf("2\nAAA.B\n.ABBB\n.A..B\n.....");
  if (n == 3 && m == 7) printf("3\nAAABCCC\n.A.B.C.\n.ABBBC.");
  if (n == 7 && m == 3) printf("3\nAAA\n.A.\n.AB\nBBB\n.CB\n.C.\nCCC");
  if (n == 3 && m == 8) printf("3\nAAA.BCCC\n.ABBB.C.\n.A..B.C.");
  if (n == 8 && m == 3) printf("3\nAAA\n.A.\n.AB\nBBB\n.CB\n.C.\nCCC\n...");
  if (n == 4 && m == 6) printf("3\nAAABBB\n.AC.B.\n.AC.B.\n.CCC..");
  if (n == 6 && m == 4) printf("3\nAAA.\n.AB.\n.AB.\nCBBB\nCCC.\nC...");
  if (n == 3 && m == 9) printf("4\nAAABCCC.D\n.A.B.CDDD\n.ABBBC..D");
  if (n == 9 && m == 3)
    printf("4\nAAA\n.A.\n.AB\nBBB\nC.B\nCCC\nC.D\nDDD\n..D");
  if (n == 4 && m == 7) printf("4\nAAABBB.\n.AC.BD.\n.AC.BD.\n.CCCDDD");
  if (n == 7 && m == 4) printf("4\nAAA.\n.AB.\n.AB.\nCBBB\nCCCD\nCDDD\n...D");
  if (n == 6 && m == 5) printf("4\nAAA.B\n.ABBB\n.AC.B\nCCCD.\n..CD.\n..DDD");
  if (n == 4 && m == 8) printf("4\nAAA.BCCC\n.ABBBDC.\n.A..BDC.\n....DDD.");
  if (n == 8 && m == 4)
    printf("4\nAAA.\n.AB.\n.AB.\nCBBB\nCCCD\nCDDD\n...D\n....");
  if (n == 5 && m == 7)
    printf("5\nAAA.B..\n.ABBBC.\nDA.EBC.\nDDDECCC\nD.EEE..");
  if (n == 7 && m == 5)
    printf("5\nAAA.B\n.ABBB\n.AC.B\nCCCD.\n.ECD.\n.EDDD\nEEE..");
  if (n == 4 && m == 9) printf("5\nA..CCCE..\nAAABCDEEE\nABBBCDE..\n...BDDD..");
  if (n == 6 && m == 6)
    printf("5\nAAA.B.\n.ABBB.\n.A.CB.\nDCCCE.\nDDDCE.\nD..EEE");
  if (n == 9 && m == 4)
    printf("5\nAAA.\n.AB.\n.AB.\nCBBB\nCCCD\nCDDD\nEEED\n.E..\n.E..");
  if (n == 5 && m == 8)
    printf("6\nAAA.BCCC\n.ABBBDC.\nEA.FBDC.\nEEEFDDD.\nE.FFF...");
  if (n == 8 && m == 5)
    printf("6\nAAA.B\n.ABBB\nCA.DB\nCCCD.\nCEDDD\n.EFFF\nEEEF.\n...F.");
  if (n == 6 && m == 7)
    printf("6\nA..C..E\nAAACEEE\nABCCCFE\n.B.D.F.\nBBBDFFF\n..DDD..");
  if (n == 7 && m == 6)
    printf("6\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\n.EC.FD\n.EFFF.\nEEE.F.");
  if (n == 5 && m == 9)
    printf("7\nAAA.BCCC.\n.ABBBDC..\nEA.FBDCG.\nEEEFDDDG.\nE.FFF.GGG");
  if (n == 9 && m == 5)
    printf("7\nAAA.B\n.ABBB\nCA.DB\nCCCD.\nCEDDD\n.EEEF\nGEFFF\nGGG.F\nG....");
  if (n == 6 && m == 8)
    printf("7\nAAA.BCCC\n.ABBBDC.\n.AE.BDC.\nEEEFDDDG\n..EF.GGG\n..FFF..G");
  if (n == 8 && m == 6)
    printf("7\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\n..CE.D\nFEEEG.\nFFFEG.\nF..GGG");
  if (n == 7 && m == 7)
    printf("8\nAAABCCC\n.A.B.C.\nDABBBCE\nDDDFEEE\nDG.F.HE\n.GFFFH.\nGGG.HHH");
  if (n == 6 && m == 9)
    printf(
        "8\nAAA.B..C.\n.ABBBCCC.\n.A.DBE.C.\nFDDDGEEEH\nFFFDGEHHH\nF..GGG..H");
  if (n == 9 && m == 6)
    printf(
        "8\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\nE.CF.D\nEEEF..\nEGFFFH\n.G."
        "HHH\nGGG..H");
  if (n == 7 && m == 8)
    printf(
        "9\nA.BBB..C\nAAABDCCC\nA.EBDDDC\nEEEFDGGG\n.HEF.IG.\n.HFFFIG.\nHHH."
        "III.");
  return 0;
}