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;
using namespace std;
int dip[4][5][2] = {{{0, 0}, {0, 1}, {0, 2}, {1, 1}, {2, 1}},
                    {{0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 2}},
                    {{0, 1}, {1, 1}, {2, 0}, {2, 1}, {2, 2}},
                    {{0, 0}, {1, 0}, {1, 1}, {1, 2}, {2, 0}}};
int n, m;
int res = -1;
int K;
vector<vector<int> > vg;
bool f[300], h[300], g[300];
string s99[9] = {"AAA.BCCC.", ".ABBB.CD.", "EA.FB.CD.",
                 "EEEF.GDDD", "EHFFFGIII", ".HHHGGGI.",
                 "JHKKKL.IM", "JJJK.LMMM", "J..KLLL.M"};
int code(int y, int x, int r) { return 4 * (y * (m - 2) + x) + r; }
void func() {
  int cur = 0;
  for (int i = 0; i < 300; i++) {
    int dix = rand() % K;
    if (!f[dix]) {
      for (int ito = 0; ito < vg[dix].size(); ito++) {
        f[vg[dix][ito]] = true;
      }
      f[dix] = true;
      h[dix] = true;
      cur++;
    }
  }
  if (cur > res) {
    res = cur;
    memcpy(g, h, sizeof(g));
  }
}
int main() {
  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 (n == 9 && m == 9) {
    cout << 13 << endl;
    for (int i = 0; i < 9; i++) {
      cout << s99[i] << endl;
    }
    return 0;
  }
  if (n == 8 && m == 9) {
    cout << 12 << endl;
    cout << "AAA.BBB.C\n.ADDDBCCC\nEA.DFB.GC\nEEEDFFFG.\nEHHHFIGGG\n.JH."
            "KIIIL\n.JH.KILLL\nJJJKKK..L\n";
    return 0;
  }
  if (n == 9 && m == 8) {
    cout << 12 << endl;
    cout << "AAA.BCCC\n.ABBBDC.\n.A.EBDC.\nFEEEDDDG\nFFFEHGGG\nFIIIHHHG\n."
            "JIKHLLL\n.JIKKKL.\nJJJK..L.\n";
    return 0;
  }
  K = 4 * (n - 2) * (m - 2);
  vg = vector<vector<int> >(K);
  for (int y1 = 0; y1 < (int)n - 2; ++y1)
    for (int x1 = 0; x1 < (int)m - 2; ++x1)
      for (int r1 = 0; r1 < (int)4; ++r1) {
        for (int y2 = 0; y2 < (int)n - 2; ++y2)
          for (int x2 = 0; x2 < (int)m - 2; ++x2)
            for (int r2 = 0; r2 < (int)4; ++r2) {
              bool col = false;
              for (int u1 = 0; u1 < (int)5; ++u1)
                for (int u2 = 0; u2 < (int)5; ++u2) {
                  int ay1 = y1 + dip[r1][u1][0];
                  int ax1 = x1 + dip[r1][u1][1];
                  int ay2 = y2 + dip[r2][u2][0];
                  int ax2 = x2 + dip[r2][u2][1];
                  if (ay1 == ay2 && ax1 == ax2) {
                    col = true;
                  }
                }
              if (col) {
                vg[code(y1, x1, r1)].push_back(code(y2, x2, r2));
              }
            }
      }
  for (int y = 0; y < (int)n - 2; ++y)
    for (int x = 0; x < (int)m - 2; ++x)
      for (int r1 = 0; r1 < (int)4; ++r1)
        for (int r2 = 0; r2 < (int)4; ++r2)
          if (r1 != r2) {
            vg[code(y, x, r1)].push_back(code(y, x, r2));
          }
  res = 0;
  memset(g, false, sizeof(g));
  for (int itr = 0; itr < 50000; itr++) {
    memset(f, false, sizeof(f));
    memset(h, false, sizeof(h));
    func();
  }
  cout << res << endl;
  vector<string> res(n, string(m, '.'));
  int z = 0;
  for (int i = 0; i < (int)K; ++i)
    if (g[i]) {
      int x = i / 4 % (m - 2), y = i / 4 / (m - 2), r = i % 4;
      for (int u = 0; u < (int)5; ++u) {
        res[y + dip[r][u][0]][x + dip[r][u][1]] = 'A' + z;
      }
      z++;
    }
  for (int i = 0; i < (int)n; ++i) cout << res[i] << endl;
  return 0;
}