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;
const long long MXN = 2e5 + 10;
long long n, m, ans;
string S[10];
bool f;
void Print() {
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < m; j++) ans = max(ans, S[i][j] - 'A' + 1ll);
  }
  cout << ans << '\n';
  if (f) {
    for (int j = 1; j <= m; j++) {
      for (int i = 1; i <= n; i++) cout << S[i][j - 1];
      cout << '\n';
    }
    return;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << S[i][j - 1];
    cout << '\n';
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  if (min(n, m) <= 2) {
    cout << 0 << '\n';
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) cout << '.';
      cout << '\n';
    }
    return 0;
  }
  if (m < n) swap(n, m), f = 1;
  if (n == 3 && m == 3) {
    S[1] = ".A.";
    S[2] = ".A.";
    S[3] = "AAA";
    Print();
  }
  if (n == 3 && m == 4) {
    S[1] = ".A..";
    S[2] = ".A..";
    S[3] = "AAA.";
    Print();
    return 0;
  }
  if (n == 3 && m == 5) {
    S[1] = ".ABBB";
    S[2] = ".A.B.";
    S[3] = "AAAB.";
    Print();
  }
  if (n == 3 && m == 6) {
    S[1] = ".ABBB.";
    S[2] = ".A.B..";
    S[3] = "AAAB..";
    Print();
  }
  if (n == 3 && m == 7) {
    S[1] = ".ABBBC.";
    S[2] = ".A.B.C.";
    S[3] = "AAABCCC";
    Print();
  }
  if (n == 3 && m == 8) {
    S[1] = ".ABBBC..";
    S[2] = ".A.B.C..";
    S[3] = "AAABCCC.";
    Print();
  }
  if (n == 3 && m == 9) {
    S[1] = ".ABBBCDDD";
    S[2] = ".A.B.C.D.";
    S[3] = "AAABCCCD.";
    Print();
  }
  if (n == 4 && m == 4) {
    S[1] = "AAA.";
    S[2] = ".AB.";
    S[3] = ".AB.";
    S[4] = ".BBB";
    Print();
  }
  if (n == 4 && m == 5) {
    S[1] = "A.BBB";
    S[2] = "AAAB.";
    S[3] = "A..B.";
    S[4] = ".....";
    Print();
  }
  if (n == 4 && m == 6) {
    S[1] = "A.BBB.";
    S[2] = "AAABC.";
    S[3] = "A..BC.";
    S[4] = "...CCC";
    Print();
  }
  if (n == 4 && m == 7) {
    S[1] = "AAADDD.";
    S[2] = ".AB.DC.";
    S[3] = ".AB.DC.";
    S[4] = ".BBBCCC";
    Print();
  }
  if (n == 4 && m == 8) {
    S[1] = "AAADDD..";
    S[2] = ".AB.DC..";
    S[3] = ".AB.DC..";
    S[4] = ".BBBCCC.";
    Print();
  }
  if (n == 4 && m == 9) {
    S[1] = "AAADDDEEE";
    S[2] = ".AB.DC.E.";
    S[3] = ".AB.DC.E.";
    S[4] = ".BBBCCC..";
    Print();
  }
  if (n == 5 && m == 5) {
    S[1] = "AAA.B";
    S[2] = ".ABBB";
    S[3] = "CA.DB";
    S[4] = "CCCD.";
    S[5] = "C.DDD";
    Print();
  }
  if (n == 5 && m == 6) {
    S[1] = "AAA.B.";
    S[2] = ".ABBB.";
    S[3] = "CA.DB.";
    S[4] = "CCCD..";
    S[5] = "C.DDD.";
    Print();
  }
  if (n == 5 && m == 7) {
    S[1] = "AAABBB.";
    S[2] = ".A..B..";
    S[3] = "CA.DB.E";
    S[4] = "CCCDEEE";
    S[5] = "C.DDD.E";
    Print();
  }
  if (n == 5 && m == 8) {
    S[1] = "AAABBB.F";
    S[2] = ".A..BFFF";
    S[3] = "CA.DB.EF";
    S[4] = "CCCDEEE.";
    S[5] = "C.DDD.E.";
    Print();
  }
  if (n == 5 && m == 9) {
    S[1] = "AAABBB..G";
    S[2] = ".A..BEGGG";
    S[3] = "DA.CBE.FG";
    S[4] = "DDDCEEEF.";
    S[5] = "D.CCC.FFF";
    Print();
  }
  if (n == 6 && m == 6) {
    S[1] = "AAA..E";
    S[2] = ".ADEEE";
    S[3] = ".ADDDE";
    S[4] = "B.DC..";
    S[5] = "BBBC..";
    S[6] = "B.CCC.";
    Print();
  }
  if (n == 6 && m == 7) {
    S[1] = "AAA..E.";
    S[2] = ".ADEEE.";
    S[3] = ".ADDDE.";
    S[4] = "B.DC..F";
    S[5] = "BBBCFFF";
    S[6] = "B.CCC.F";
    Print();
  }
  if (n == 6 && m == 8) {
    S[1] = "AAA.G...";
    S[2] = ".AC.GFFF";
    S[3] = ".ACGGGF.";
    S[4] = "BCCCD.FE";
    S[5] = "BBB.DEEE";
    S[6] = "B..DDD.E";
    Print();
  }
  if (n == 6 && m == 9) {
    S[1] = ".EFFFGHHH";
    S[2] = ".E.F.G.H.";
    S[3] = "EEEFGGGH.";
    S[4] = ".ABBBCDDD";
    S[5] = ".A.B.C.D.";
    S[6] = "AAABCCCD.";
    Print();
  }
  if (n == 7 && m == 7) {
    S[1] = "HHHG..F";
    S[2] = ".H.GFFF";
    S[3] = "DHGGGEF";
    S[4] = "DDDEEE.";
    S[5] = "DABBBEC";
    S[6] = ".A.BCCC";
    S[7] = "AAAB..C";
    Print();
  }
  if (n == 7 && m == 8) {
    S[1] = "AAA.GGG.";
    S[2] = ".ABBBGH.";
    S[3] = ".ACB.GH.";
    S[4] = "CCCBIHHH";
    S[5] = "D.CEIIIF";
    S[6] = "DDDEIFFF";
    S[7] = "D.EEE..F";
    Print();
  }
  if (n == 7 && m == 9) {
    S[1] = "AAA.GGG.F";
    S[2] = ".ABBBGFFF";
    S[3] = ".ACBHG.IF";
    S[4] = "CCCBHHHI.";
    S[5] = "D.CEHJIII";
    S[6] = "DDDE.JJJ.";
    S[7] = "D.EEEJ...";
    Print();
  }
  if (n == 8 && m == 8) {
    S[1] = "A.BBBCCC";
    S[2] = "AAAB..C.";
    S[3] = "AF.BEDC.";
    S[4] = ".FEEEDDD";
    S[5] = "FFFHEDJ.";
    S[6] = "GHHHI.J.";
    S[7] = "GGGHIJJJ";
    S[8] = "G..III..";
    Print();
  }
  if (n == 8 && m == 9) {
    S[1] = "A.FFF.LLL";
    S[2] = "AAAFKKKL.";
    S[3] = "AB.FGK.LJ";
    S[4] = ".BGGGKJJJ";
    S[5] = "BBBDGIIIJ";
    S[6] = "CDDDE.IH.";
    S[7] = "CCCDE.IH.";
    S[8] = "C..EEEHHH";
    Print();
  }
  if (n == 9 && m == 9) {
    S[1] = "AAACDDD.E";
    S[2] = ".A.C.DEEE";
    S[3] = "BACCCDL.E";
    S[4] = "BBB.F.LLL";
    S[5] = "BMFFF.L.K";
    S[6] = ".MMMFJKKK";
    S[7] = "GM.H.J.IK";
    S[8] = "GGGHJJJI.";
    S[9] = "G.HHH.III";
    Print();
  }
  return 0;
}