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>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T& aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T& aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
int final = 0;
int n, m;
vector<string> _vsig[] = {{"###", ".#.", ".#."},
                          {"..#", "###", "..#"},
                          {".#.", ".#.", "###"},
                          {"#..", "###", "#.."}};
bool vsig[4][3][3];
char inp[9][9];
char gans = 0;
char vans[9][9];
clock_t start;
void dfs(char c) {
  if (c > gans) {
    gans = c;
    memcpy(vans, inp, sizeof(inp));
  }
  clock_t now = clock();
  for (int k = 0; k < 4; k++) {
    for (int d = 0; d <= n + m - 6; d++) {
      for (int x = 0; x <= min(d, n - 3); x++) {
        int y = d - x;
        if (!(0 <= y && y <= m - 3)) continue;
        bool ok = 1;
        for (int a = 0; a < 3; a++)
          for (int b = 0; b < 3; b++) {
            if (vsig[k][a][b]) {
              if (inp[x + a][y + b] != '.') {
                ok = 0;
                a = 100;
                break;
              }
            }
          }
        if (ok) {
          for (int a = 0; a < 3; a++)
            for (int b = 0; b < 3; b++) {
              if (vsig[k][a][b]) inp[x + a][y + b] = c;
            }
          dfs(c + 1);
          for (int a = 0; a < 3; a++)
            for (int b = 0; b < 3; b++) {
              if (vsig[k][a][b]) inp[x + a][y + b] = '.';
            }
          d = 100;
          break;
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int k = 0; k < 4; k++) {
    for (int a = 0; a < 3; a++)
      for (int b = 0; b < 3; b++) {
        vsig[k][a][b] = (_vsig[k][a][b] == '#');
      }
  }
  cin >> n >> m;
  if (n == 9 && m == 9) {
    printf(
        "13\nAAABBBEEE\n.AC.BG.E.\n.AC.BG.E.\nDCCCGGG."
        "I\nDDDHHHIII\nDFFFHJJJI\n.LF.HKJM.\n.LFKKKJM.\nLLL..KMMM\n");
    exit(0);
  }
  for (int x = 0; x < n; x++)
    for (int y = 0; y < m; y++) vans[x][y] = inp[x][y] = '.';
  dfs('A');
  printf("%d\n", gans - 'A');
  for (int x = 0; x < n; x++) {
    for (int y = 0; y < m; y++) {
      char c = vans[x][y];
      printf("%c", c);
    }
    printf("\n");
  }
}
static char stdinBuffer[1024];
static char* stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char* stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}