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;
int getint() {
  unsigned int c;
  int x = 0;
  while (((c = getchar()) - '0') >= 10) {
    if (c == '-') return -getint();
    if (!~c) exit(0);
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while (((c = getchar()) - '0') < 10);
  return x;
}
char a1[] = "### ..# .#. #..";
char a2[] = ".#. ### .#. ###";
char a3[] = ".#. ..# ### #..";
vector<int> px[4], py[4];
int n, m, grid[10][10], mx, res[10][10];
void solve(int x, int y, int curr) {
  if (y >= m) {
    solve(x + 1, 0, curr);
    return;
  }
  if (x >= n) {
    if (curr > mx) mx = curr, memcpy(res, grid, sizeof(res));
    return;
  }
  int i, j, k, d, tmp[10][10], nx, ny;
  int mxPossible = 0;
  for (i = y; i < m; i++)
    if (grid[x][i] == 0) mxPossible++;
  for (i = x; i < n; i++)
    for (j = 0; j < m; j++)
      if (grid[i][j] == 0) mxPossible++;
  mxPossible /= 5;
  if (mxPossible + curr <= mx) return;
  memcpy(tmp, grid, sizeof(tmp));
  for (d = 0; d < 4; d++) {
    bool canPlace = 1;
    memcpy(grid, tmp, sizeof(tmp));
    for (i = 0; i < px[d].size(); i++) {
      nx = x + px[d][i];
      ny = y + py[d][i];
      if (nx >= n or ny >= m or grid[nx][ny]) {
        canPlace = 0;
        break;
      }
      grid[nx][ny] = curr + 1;
    }
    if (canPlace) {
      solve(x, y + 1, curr + 1);
    }
  }
  memcpy(grid, tmp, sizeof(tmp));
  solve(x, y + 1, curr);
}
int main() {
  int i, j, tcc, tc = 1 << 28;
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 3; j++)
      if (a1[i * 4 + j] == '#') px[i].push_back(0), py[i].push_back(j);
    for (j = 0; j < 3; j++)
      if (a2[i * 4 + j] == '#') px[i].push_back(1), py[i].push_back(j);
    for (j = 0; j < 3; j++)
      if (a3[i * 4 + j] == '#') px[i].push_back(2), py[i].push_back(j);
  }
  for (tcc = 0; tcc < tc; tcc++) {
    n = getint(), m = getint(), mx = 0;
    if (n == 9 and m == 9) {
      puts("13");
      puts(
          "AAA.BCCC.\n.ABBB.CD.\n.AE.BFCD.\nEEEFFFDDD\nG.E.HFIII\nGGGJHHHI."
          "\nGK.JHL.IM\n.KJJJLMMM\nKKK.LLL.M\n");
      continue;
    }
    memset(res, 0, sizeof(res));
    memset(grid, 0, sizeof(grid));
    solve(0, 0, 0);
    printf("%d\n", mx);
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (res[i][j] == 0)
          putchar('.');
        else
          putchar('A' + res[i][j] - 1);
      }
      puts("");
    }
    puts("");
  }
  return 0;
}