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 ll = long long;
using ld = long double;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cout.precision(20);
  map<int, map<int, string> > R;
  map<int, vector<int> > V;
  R[3][0] = "AAABCCCD.";
  R[3][1] = ".A.B.C.D.";
  R[3][2] = ".ABBBCDDD";
  V[3] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 4};
  R[4][0] = "AAAC..EEE";
  R[4][1] = ".ABCCCDE.";
  R[4][2] = ".ABCDDDE.";
  R[4][3] = ".BBB..D..";
  V[4] = {0, 0, 0, 1, 2, 2, 3, 4, 4, 5};
  R[5][0] = "AAA.CFFF.";
  R[5][1] = ".ACCCEF..";
  R[5][2] = "BA.DCEFG.";
  R[5][3] = "BBBDEEEG.";
  R[5][4] = "B.DDD.GGG";
  V[5] = {0, 0, 0, 2, 2, 4, 4, 5, 6, 7};
  R[6][0] = "AAA.DF...";
  R[6][1] = ".ADDDFFFH";
  R[6][2] = ".A.CDFHHH";
  R[6][3] = "BCCCEGGGH";
  R[6][4] = "BBBCE.G..";
  R[6][5] = "B..EEEG..";
  V[6] = {0, 0, 0, 2, 3, 4, 5, 5, 7, 8};
  R[7][0] = "AAADFFF.I";
  R[7][1] = ".A.D.FIII";
  R[7][2] = "BADDDFG.I";
  R[7][3] = "BBB.GGG..";
  R[7][4] = "BCEEEHG.J";
  R[7][5] = ".C.E.HJJJ";
  R[7][6] = "CCCEHHH.J";
  V[7] = {0, 0, 0, 3, 3, 5, 5, 8, 8, 10};
  R[8][0] = "AAAE..H..";
  R[8][1] = ".A.EHHHJ.";
  R[8][2] = "BAEEEFHJ.";
  R[8][3] = "BBBFFFJJJ";
  R[8][4] = "BDDD.FI..";
  R[8][5] = ".CDGIIIK.";
  R[8][6] = ".CDGGGIK.";
  R[8][7] = "CCCG..KKK";
  V[8] = {0, 0, 0, 3, 4, 5, 7, 9, 9, 11};
  R[9][0] = "AAA..G...";
  R[9][1] = ".A.GGGKKK";
  R[9][2] = "BAEEEGJK.";
  R[9][3] = "BBBEH.JK.";
  R[9][4] = "B.CEHJJJL";
  R[9][5] = "CCCHHHLLL";
  R[9][6] = "D.CFIIIML";
  R[9][7] = "DDDF.I.M.";
  R[9][8] = "D.FFFIMMM";
  V[9] = {0, 0, 0, 4, 4, 6, 8, 9, 10, 13};
  int n, m;
  cin >> n >> m;
  if (min(n, m) < 3) {
    cout << 0 << endl;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        cout << '.';
      }
      cout << endl;
    }
    return 0;
  }
  if (min(n, m) == 6 && max(n, m) == 7) {
    vector<string> E(7);
    E[0] = "AAAD..";
    E[1] = ".A.D..";
    E[2] = "BADDDF";
    E[3] = "BBBFFF";
    E[4] = "BCEEEF";
    E[5] = ".C.E..";
    E[6] = "CCCE..";
    cout << 6 << endl;
    if (n == 7) {
      for (int i = 0; i < n; ++i) cout << E[i] << endl;
    } else {
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          cout << E[j][i];
        }
        cout << endl;
      }
    }
    return 0;
  }
  if (n == 8 && m == 8) {
    cout << 10 << endl;
    cout << "AAAE.III" << endl;
    cout << ".ADEEEI." << endl;
    cout << ".ADEF.IJ" << endl;
    cout << "BDDDFJJJ" << endl;
    cout << "BBBFFFHJ" << endl;
    cout << "B.CGHHH." << endl;
    cout << "CCCGGGH." << endl;
    cout << "..CG...." << endl;
    return 0;
  }
  if (min(n, m) == 8 and max(m, n) == 9) {
    cout << 12 << endl;
    vector<string> E(8);
    E[0] = "A.EEE.JJJ";
    E[1] = "AAAEHHHJ.";
    E[2] = "AB.EFHKJ.";
    E[3] = ".BFFFHKKK";
    E[4] = "BBBDFIK..";
    E[5] = "CDDDGIIIL";
    E[6] = "CCCDGILLL";
    E[7] = "C..GGG..L";
    if (n == 8) {
      for (int i = 0; i < n; ++i) cout << E[i] << endl;
    } else {
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          cout << E[j][i];
        }
        cout << endl;
      }
    }
    return 0;
  }
  if (V[n][m] < V[m][n]) {
    cout << V[m][n] << endl;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (R[m][j][i] < 'A' + V[m][n]) {
          cout << R[m][j][i];
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
  } else {
    cout << V[n][m] << endl;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (R[n][i][j] < 'A' + V[n][m]) {
          cout << R[n][i][j];
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
  }
  return 0;
}