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;
inline long long read() {
  char ch = getchar();
  long long f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  long long x = 0;
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * f;
}
const int MAXN = 1e5 + 10;
string f[MAXN] = {
    "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 main() {
  long long n = read(), m = read(), ans = (n - 1) * 9 + (m - 1);
  cout << f[ans];
  return 0;
}