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 ans[10][10] =
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},    {-1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
     {-1, 0, 0, 0, 0, 0, 0, 0, 0, 0},   {-1, 0, 0, 1, 1, 2, 2, 3, 3, 4},
     {-1, 0, 0, 1, 2, 2, 3, 4, 4, 5},   {-1, 0, 0, 2, 2, 4, 4, 5, 6, 7},
     {-1, 0, 0, 2, 3, 4, 5, 6, 7, 8},   {-1, 0, 0, 3, 4, 5, 6, 8, 9, 10},
     {-1, 0, 0, 3, 4, 6, 7, 9, 10, 12}, {-1, 0, 0, 4, 5, 7, 8, 10, 12, 13}},
    N, M;
string Sol[10][10][10] = {
    {{}, {}, {}, {}, {}, {}, {}, {}, {}, {}},
    {{""},
     {"."},
     {".."},
     {"..."},
     {"...."},
     {"....."},
     {"......"},
     {"......."},
     {"........"},
     {"........."}},
    {{"", ""},
     {".", "."},
     {"..", ".."},
     {"...", "..."},
     {"....", "...."},
     {".....", "....."},
     {"......", "......"},
     {".......", "......."},
     {"........", "........"},
     {".........", "........."}},
    {{"", "", ""},
     {".", ".", "."},
     {"..", "..", ".."},
     {"A..", "AAA", "A.."},
     {"A...", "AAA.", "A..."},
     {"A.BBB", "AAAB.", "A..B."},
     {"A.BBB.", "AAAB..", "A..B.."},
     {"A.BBBC.", "AAAB.C.", "A..BCCC"},
     {"A.BBBC..", "AAAB.C..", "A..BCCC."},
     {"A.BBBCDDD", "AAAB.C.D.", "A..BCCCD."}},
    {{"", "", "", ""},
     {".", ".", ".", "."},
     {"..", "..", "..", ".."},
     {"A..", "AAA", "A..", "..."},
     {"A...", "AAAB", "ABBB", "...B"},
     {"A.BBB", "AAAB.", "A..B.", "....."},
     {"A.BBB.", "AAABC.", "A..BC.", "...CCC"},
     {"A..BBB.", "AAACBD.", "ACCCBD.", "...CDDD"},
     {"A.BBBC..", "AAABDCCC", "A..BDC..", "...DDD.."},
     {"A.BBBC...", "AAABDCCCE", "A..BDCEEE", "...DDD..E"}},
    {{"", "", "", "", ""},
     {".", ".", ".", ".", "."},
     {"..", "..", "..", "..", ".."},
     {"A..", "AAA", "AB.", ".B.", "BBB"},
     {"A...", "AAAB", "ABBB", "...B", "...."},
     {"A.BBB", "AAAB.", "AC.BD", ".CDDD", "CCC.D"},
     {"A.BBB.", "AAABC.", "AD.BC.", ".D.CCC", "DDD..."},
     {"A.BBB.C", "AAABCCC", "AD.BE.C", ".D..E..", "DDDEEE."},
     {"A.BBBC..", "AAABDCCC", "AE.BDCF.", ".E.DDDF.", "EEE..FFF"},
     {"A.BBB.CCC", "AAABDDDC.", "AE.BFDGC.", ".E..FDGGG", "EEEFFFG.."}},
    {{"", "", "", "", "", ""},
     {".", ".", ".", ".", ".", "."},
     {"..", "..", "..", "..", "..", ".."},
     {"A..", "AAA", "AB.", ".B.", "BBB", "..."},
     {"A...", "AAAB", "ABBB", "C..B", "CCC.", "C..."},
     {"A.BBB", "AAAB.", "AC.BD", ".CDDD", "CCC.D", "....."},
     {"A.BBB.", "AAAB..", "A.CB..", ".DCCCE", ".DCEEE", "DDD..E"},
     {"A.BBBC.", "AAAB.C.", "AD.BCCC", ".DEEEF.", "DDDE.F.", "...EFFF"},
     {"A.BBBC..", "AAAB.CCC", "AD.BEC..", ".D.FEEEG", "DDDFEGGG", "..FFF..G"},
     {"A.BBBCDDD", "AAAB.C.D.", "AE.BCCCDF", ".EGGGHFFF", "EEEG.H..F",
      "...GHHH.."}},
    {{"", "", "", "", "", "", ""},
     {".", ".", ".", ".", ".", ".", "."},
     {"..", "..", "..", "..", "..", "..", ".."},
     {"A..", "AAA", "A.B", "BBB", "C.B", "CCC", "C.."},
     {"A...", "AAAB", "ABBB", "C..B", "CCCD", "CDDD", "...D"},
     {"A.BBB", "AAAB.", "AC.BD", ".CDDD", "CCCED", "...E.", "..EEE"},
     {"A.BBB.", "AAABC.", "A.DBC.", "..DCCC", "EDDDF.", "EEE.F.", "E..FFF"},
     {"A.BBB.C", "AAABCCC", "AD.BE.C", ".DDDEEE", "FD.GE.H", "FFFGHHH",
      "F.GGG.H"},
     {"A.BBB..C", "AAABDCCC", "AE.BDDDC", ".EEEDFFF", "GEHHHIF.", "GGGH.IF.",
      "G..HIII."},
     {"A.BBBCDDD", "AAAB.C.D.", "AE.BCCCDF", ".EEEG.FFF", "HE.IGGGJF",
      "HHHIG..J.", "H.III.JJJ"}},
    {{"", "", "", "", "", "", "", ""},
     {".", ".", ".", ".", ".", ".", ".", "."},
     {"..", "..", "..", "..", "..", "..", "..", ".."},
     {"A..", "AAA", "AB.", ".B.", "BBB", "C..", "CCC", "C.."},
     {"A...", "AAAB", "ABBB", "C..B", "CCCD", "CDDD", "...D", "...."},
     {"A.BBB", "AAAB.", "AC.BD", ".CDDD", "CCCED", "FFFE.", ".FEEE", ".F..."},
     {"A.BBB.", "AAABC.", "AD.BC.", ".D.CCC", "DDDE..", "FEEEG.", "FFFEG.",
      "F..GGG"},
     {"A..BCCC", "AAAB.C.", "ADBBBCE", ".DDDEEE", "FD.GGGE", "FFFHGI.",
      "FHHHGI.", "...HIII"},
     {"A.BBBC..", "AAAB.C..", "AD.BCCCE", ".DFFFEEE", "DDDFGGGE", "HHHFIGJ.",
      ".HIIIGJ.", ".H..IJJJ"},
     {"A.BBBC...", "AAABDCCCE", "A.FBDCEEE", "FFFDDDG.E", "H.FIIIGGG",
      "HHHJIKG.L", "HJJJIKLLL", "...JKKK.L"}},
    {{"", "", "", "", "", "", "", "", ""},
     {".", ".", ".", ".", ".", ".", ".", ".", "."},
     {"..", "..", "..", "..", "..", "..", "..", "..", ".."},
     {"A..", "AAA", "A.B", "BBB", "C.B", "CCC", "CD.", ".D.", "DDD"},
     {"A...", "AAAB", "ABBB", "C..B", "CCCD", "CDDD", "E..D", "EEE.", "E..."},
     {"A.BBB", "AAAB.", "AC.BD", ".CDDD", "CCCED", "FEEE.", "FFFEG", "F.GGG",
      "....G"},
     {"A.BBB.", "AAABC.", "AD.BC.", ".D.CCC", "DDDE..", "FFFEEE", ".FGE.H",
      ".FGHHH", ".GGG.H"},
     {"A.BBBC.", "AAAB.C.", "A.DBCCC", "DDDE...", "F.DEEEG", "FFFEGGG",
      "FHIIIJG", ".H.I.J.", "HHHIJJJ"},
     {"A.BBBCCC", "AAAB.DC.", "AE.B.DC.", ".EEEDDDF", "GEHHHFFF", "GGGHIIIF",
      "GJ.HKIL.", ".JKKKIL.", "JJJ.KLLL"},
     {"A.BBBCDDD", "AAAB.C.D.", "AE.BCCCDF", ".EGGGHFFF", "EEEGIHHHF",
      "JJJGIHKKK", ".JLIIIMK.", ".JL...MK.", ".LLL.MMM."}}};
int main() {
  scanf("%d %d", &N, &M);
  printf("%d\n", ans[N][M]);
  for (int i = 0; i < N; i++) cout << Sol[N][M][i] << endl;
  return 0;
}