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>
int xx[4][5] = {
    {0, 0, 0, 1, 2}, {0, 1, 1, 1, 2}, {0, 1, 2, 2, 2}, {0, 1, 1, 1, 2}};
int yy[4][5] = {
    {0, 1, 2, 1, 1}, {2, 0, 1, 2, 2}, {1, 1, 0, 1, 2}, {0, 0, 1, 2, 0}};
struct num {
  int x, y, z;
};
int l[(20 * 20 * 25)], r[(20 * 20 * 25)], d[(20 * 20 * 25)], u[(20 * 20 * 25)],
    c[(20 * 20 * 25)], add[(20 * 20 * 25)], s[(20 * 20)], tmp[(20 * 20)];
num o[100], name[(20 * 20 * 25)], best[100];
int bb[20][20];
char out[20][20];
int n, m, i, j, k, i1, len = 0, ans = 0, ss = 0;
inline int calc(int x, int y) { return (x - 1) * m + y; }
void remove(int x) {
  l[r[x]] = l[x];
  r[l[x]] = r[x];
  for (int i = d[x]; i != x; i = d[i]) {
    for (int j = r[i]; j != i; j = r[j]) {
      u[d[j]] = u[j];
      d[u[j]] = d[j];
      s[c[j]]--;
      ss++;
    }
  }
}
void resume(int x) {
  for (int i = u[x]; i != x; i = u[i])
    for (int j = l[i]; j != i; j = l[j]) {
      u[d[j]] = j;
      d[u[j]] = j;
      s[c[j]]++;
      ss++;
    }
  l[r[x]] = x;
  r[l[x]] = x;
}
void dfs(int t) {
  if (ss > 70000000) return;
  if (!r[0]) {
    if (t > ans) {
      ans = t;
      memcpy(best, o, sizeof(o));
    }
    return;
  }
  int x = 0, min = 100000;
  for (int i = r[0]; i; i = r[i])
    if (s[i] < min) min = s[i], x = i;
  remove(x);
  for (int i = d[x]; i != x; i = d[i]) {
    for (int j = r[i]; j != i; j = r[j]) remove(c[j]);
    if (add[i] == 1) o[t + 1] = name[i];
    dfs(t + add[i]);
    for (int j = l[i]; j != i; j = l[j]) resume(c[j]);
  }
  resume(x);
}
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      r[len] = len + 1;
      ++len;
      l[len] = len - 1;
      c[len] = len;
      tmp[len] = len;
      add[len] = 1;
      s[len] = 1;
    }
  for (i = 1; i <= n - 2; i++)
    for (j = 1; j <= m - 2; j++)
      for (k = 0; k < 4; k++)
        for (i1 = 0; i1 < 5; i1++) {
          int x = i + xx[k][i1], y = j + yy[k][i1];
          ++len;
          add[len] = 1;
          name[len].x = i;
          name[len].y = j;
          name[len].z = k;
          s[calc(x, y)]++;
          c[len] = calc(x, y);
          if (i1 == 0)
            l[len] = len + 4;
          else
            l[len] = len - 1;
          if (i1 == 4)
            r[len] = len - 4;
          else
            r[len] = len + 1;
          u[len] = tmp[calc(x, y)];
          d[tmp[calc(x, y)]] = len;
          tmp[calc(x, y)] = len;
        }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      len++;
      c[len] = calc(i, j);
      r[len] = l[len] = len;
      u[len] = tmp[calc(i, j)];
      d[tmp[calc(i, j)]] = len;
      u[calc(i, j)] = len;
      d[len] = calc(i, j);
      s[calc(i, j)]++;
    }
  dfs(0);
  printf("%d\n", ans);
  for (i = 1; i <= ans; i++)
    for (j = 0; j < 5; j++)
      bb[best[i].x + xx[best[i].z][j]][best[i].y + yy[best[i].z][j]] = i;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      if (bb[i][j] == 0)
        out[i][j] = '.';
      else
        out[i][j] = 'A' + bb[i][j] - 1;
    }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) printf("%c", out[i][j]);
    printf("\n");
  }
  return 0;
}