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;
struct fastIO {
  inline fastIO operator>>(int& num) {
    num = 0;
    char c = getchar();
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    bool foo = 0;
    if (c == '-') {
      foo = 1;
      c = getchar();
    }
    while (c >= '0' && c <= '9') {
      num = (num << 3) + (num << 1) + c - '0';
      c = getchar();
    }
    if (foo) num = -num;
    return *this;
  }
  inline fastIO operator>>(long long& num) {
    num = 0;
    char c = getchar();
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    bool foo = 0;
    if (c == '-') {
      foo = 1;
      c = getchar();
    }
    while (c >= '0' && c <= '9') {
      num = (num << 3) + (num << 1) + c - '0';
      c = getchar();
    }
    if (foo) num = -num;
    return *this;
  }
  inline fastIO operator>>(float& num) {
    scanf("%f", &num);
    return *this;
  }
  inline fastIO operator>>(double& num) {
    scanf("%lf", &num);
    return *this;
  }
  inline fastIO operator>>(long double& num) {
    scanf("%Lf", &num);
    return *this;
  }
  inline fastIO operator>>(char& num) {
    num = getchar();
    while (num == ' ' || num == '\n') num = getchar();
    return *this;
  }
  inline fastIO operator>>(char* num) {
    int cnt = 0;
    char c = getchar();
    while (c == ' ' || c == '\n') c = getchar();
    while (c != ' ' && c != '\n') {
      num[cnt++] = c;
      c = getchar();
    }
    num[cnt] = 0;
    return *this;
  }
  inline fastIO operator>>(string& num) {
    cin >> num;
    return *this;
  }
  inline void printInt(const int& num) {
    if (num < 10) {
      putchar(num + '0');
      return;
    }
    printInt(num / 10);
    putchar((num % 10) + '0');
  }
  inline void printINT(const long long& num) {
    if (num < 10) {
      putchar(num + '0');
      return;
    }
    printINT(num / 10);
    putchar((num % 10) + '0');
  }
  inline fastIO operator<<(const int& num) {
    if (num < 0)
      putchar('-'), printInt(-num);
    else
      printInt(num);
    return *this;
  }
  inline fastIO operator<<(const long long& num) {
    if (num < 0)
      putchar('-'), printINT(-num);
    else
      printINT(num);
    return *this;
  }
  inline fastIO operator<<(const float& num) {
    printf("%.10f", num);
    return *this;
  }
  inline fastIO operator<<(const double& num) {
    printf("%.16lf", num);
    return *this;
  }
  inline fastIO operator<<(const long double& num) {
    printf("%.20Lf", num);
    return *this;
  }
  inline fastIO operator<<(const char& num) {
    putchar(num);
    return *this;
  }
  inline fastIO operator<<(const char* num) {
    for (int i = 0; num[i]; i++) putchar(num[i]);
    return *this;
  }
  inline fastIO operator<<(const string& num) {
    cout << num;
    return *this;
  }
} fio;
string dta[] = {
    "0\n.\n",
    "0\n..\n",
    "0\n...\n",
    "0\n....\n",
    "0\n.....\n",
    "0\n......\n",
    "0\n.......\n",
    "0\n........\n",
    "0\n.........\n",
    "0\n.\n.\n",
    "0\n..\n..\n",
    "0\n...\n...\n",
    "0\n....\n....\n",
    "0\n.....\n.....\n",
    "0\n......\n......\n",
    "0\n.......\n.......\n",
    "0\n........\n........\n",
    "0\n.........\n.........\n",
    "0\n.\n.\n.\n",
    "0\n..\n..\n..\n",
    "1\nAAA\n.A.\n.A.\n",
    "1\nAAA.\n.A..\n.A..\n",
    "2\nAAA.B\n.ABBB\n.A..B\n",
    "2\nAAABBB\n.A..B.\n.A..B.\n",
    "3\nAAACBBB\n.A.C.B.\n.ACCCB.\n",
    "3\nAAABBB.C\n.A..BCCC\n.A..B..C\n",
    "4\nAAADBBB.C\n.A.D.BCCC\n.ADDDB..C\n",
    "0\n.\n.\n.\n.\n",
    "0\n..\n..\n..\n..\n",
    "1\nAAA\n.A.\n.A.\n...\n",
    "2\nAAA.\n.AB.\n.AB.\n.BBB\n",
    "2\nAAA..\n.ABBB\n.A.B.\n...B.\n",
    "3\nAAABBB\n.AC.B.\n.AC.B.\n.CCC..\n",
    "4\nAAABBB.\n.AC.BD.\n.AC.BD.\n.CCCDDD\n",
    "4\nAAABBB..\n.AD.BCCC\n.AD.B.C.\n.DDD..C.\n",
    "5\nAAABBBCCC\n.AD.BE.C.\n.AD.BE.C.\n.DDDEEE..\n",
    "0\n.\n.\n.\n.\n.\n",
    "0\n..\n..\n..\n..\n..\n",
    "2\nAAA\n.A.\nBA.\nBBB\nB..\n",
    "2\nAAA.\n.A..\nBA..\nBBB.\nB...\n",
    "4\nAAA.B\n.ABBB\nCA.DB\nCCCD.\nC.DDD\n",
    "4\nAAABBB\n.A..B.\nCA.DB.\nCCCDDD\nC..D..\n",
    "5\nAAABBB.\n.A..BD.\nCA.EBD.\nCCCEDDD\nC.EEE..\n",
    "6\nAAABBB.C\n.A..BCCC\nDA.EB.FC\nDDDEEEF.\nD..E.FFF\n",
    "7\nAAA.BBB.D\n.ACCCBDDD\nEA.CFB.GD\nEEECFFFG.\nE...F.GGG\n",
    "0\n.\n.\n.\n.\n.\n.\n",
    "0\n..\n..\n..\n..\n..\n..\n",
    "2\nAAA\n.A.\nBA.\nBBB\nB..\n...\n",
    "3\nAAA.\n.A..\nBA..\nBBBC\nBCCC\n...C\n",
    "4\nAAA..\n.ABBB\nCA.B.\nCCCBD\nC.DDD\n....D\n",
    "5\nAAABBB\n.A..B.\n.AC.B.\n.ECCCD\n.ECDDD\nEEE..D\n",
    "6\nAAA.BBB\n.AC..B.\n.ACCCB.\nE.CFDDD\nEEEF.D.\nE.FFFD.\n",
    "7\nAAABBB..\n.AD.BCCC\n.AD.B.C.\nEDDDG.CF\nEEE.GFFF\nE..GGG.F\n",
    "8\nAAABBBCCC\n.AD.B..C.\n.AD.BE.C.\nFDDDHEEEG\nFFF.HEGGG\nF..HHH..G\n",
    "0\n.\n.\n.\n.\n.\n.\n.\n",
    "0\n..\n..\n..\n..\n..\n..\n..\n",
    "3\nAAA\n.A.\nBA.\nBBB\nB.C\nCCC\n..C\n",
    "4\nAAA.\n.AB.\n.AB.\nCBBB\nCCCD\nCDDD\n...D\n",
    "5\nAAA..\n.ABBB\nCA.B.\nCCCB.\nCEDDD\n.E.D.\nEEED.\n",
    "6\nAAABBB\n.A..B.\nCA.DB.\nCCCDDD\nCE.DF.\n.EEEF.\n.E.FFF\n",
    "8\nAAAC..B\n.A.CBBB\nDACCCEB\nDDDEEE.\nDHFFFEG\n.H.FGGG\nHHHF..G\n",
    "9\nAAA.BBB.\n.ACCCBE.\n.ADC.BE.\nDDDCFEEE\nG.DIFFFH\nGGGIFHHH\nG.III..H\n",
    "10\nAAA.BBB..\n.ACCCBDDD\n.AECFB.D.\nEEECFFFDG\nH.EJFIGGG\nHHHJ.IIIG\nH."
    "JJJI...\n",
    "0\n.\n.\n.\n.\n.\n.\n.\n.\n",
    "0\n..\n..\n..\n..\n..\n..\n..\n..\n",
    "3\nAAA\n.A.\nBA.\nBBB\nB..\nCCC\n.C.\n.C.\n",
    "4\nAAA.\n.A..\nBA..\nBBB.\nBCCC\n.DC.\n.DC.\nDDD.\n",
    "6\nAAA..\n.ABBB\nCA.B.\nCCCBD\nC.DDD\nEEEFD\n.E.F.\n.EFFF\n",
    "7\nAAABBB\n.A..B.\nCA.DB.\nCCCDDD\nC.ED..\n.GEEEF\n.GEFFF\nGGG..F\n",
    "9\nAAA.BBB\n.ACCCB.\nDA.CEB.\nDDDCEEE\nDFFFE.G\n.IFHGGG\n.IFHHHG\nIIIH..."
    "\n",
    "10\nAAABBB.C\n.A..BCCC\nDA.EB.FC\nDDDEEEF.\nD..EHFFF\nGGGJHHHI\n.G."
    "JHIII\n.GJJJ..I\n",
    "12\nAAA.BBB.D\n.ACCCBDDD\nEA.CFB.GD\nEEECFFFG.\nE.."
    "HFIGGG\nJHHHLIIIK\nJJJHLIKKK\nJ..LLL..K\n",
    "0\n.\n.\n.\n.\n.\n.\n.\n.\n.\n",
    "0\n..\n..\n..\n..\n..\n..\n..\n..\n..\n",
    "4\nAAA\n.A.\nBA.\nBBB\nB.C\nCCC\nD.C\nDDD\nD..\n",
    "5\nAAA.\n.A..\nBA..\nBBBC\nBCCC\nD..C\nDDDE\nDEEE\n...E\n",
    "7\nAAA..\n.ABBB\nCA.B.\nCCCBD\nCEDDD\n.EEED\nGEFFF\nGGGF.\nG..F.\n",
    "8\nAAABBB\n.A..B.\nCA.DB.\nCCCDDD\nC.ED..\nEEEFFF\nG.EHF.\nGGGHF.\nG.HHH."
    "\n",
    "10\nAAABBB.\n.A..BD.\nCA.EBD.\nCCCEDDD\nCFEEE.G\n.FFFGGG\nIFHHHJG\nIIIH.J."
    "\nI..HJJJ\n",
    "12\nAAAC.BBB\n.ADCCCB.\n.ADCE.B.\nFDDDEEEG\nFFFHEGGG\nFHHHIIIG\nJJJHKIL."
    "\n.JKKKIL.\n.J..KLLL\n",
    "13\nAAABBB..C\n.A..BDCCC\nEA.GBDDDC\nEEEG.DFFF\nEHGGG.IF.\n.HHHIIIF."
    "\nKHJJJMI.L\nKKKJ.MLLL\nK..JMMM.L\n"};
int n, m;
int main() {
  fio >> n >> m;
  fio << dta[(n - 1) * 9 + (m - 1)] << '\n';
  return 0;
}