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 comment(linker, "/STACK:256000000")
const int inf = 1e9;
const long long linf = 1e18;
const long double eps = 1e-6;
const long long mod1 = 1e9 + 7;
using namespace std;
int a[100][100], n, m;
int maxx = 0, best[100][100];
int ans[100][100];
bool ok1(int i, int j) {
  bool fl = 1;
  if (a[i + 1][j + 1]) fl = 0;
  if (a[i][j]) fl = 0;
  if (a[i][j + 2]) fl = 0;
  if (a[i][j + 1]) fl = 0;
  if (a[i + 2][j + 1]) fl = 0;
  return fl;
}
bool ok2(int i, int j) {
  bool fl = 1;
  if (a[i + 1][j + 1]) fl = 0;
  if (a[i + 1][j]) fl = 0;
  if (a[i + 1][j + 2]) fl = 0;
  if (a[i][j + 2]) fl = 0;
  if (a[i + 2][j + 2]) fl = 0;
  return fl;
}
bool ok3(int i, int j) {
  bool fl = 1;
  if (a[i + 1][j + 1]) fl = 0;
  if (a[i][j + 1]) fl = 0;
  if (a[i + 2][j + 1]) fl = 0;
  if (a[i + 2][j]) fl = 0;
  if (a[i + 2][j + 2]) fl = 0;
  return fl;
}
bool ok4(int i, int j) {
  bool fl = 1;
  if (a[i][j]) fl = 0;
  if (a[i + 1][j]) fl = 0;
  if (a[i + 2][j]) fl = 0;
  if (a[i + 1][j + 1]) fl = 0;
  if (a[i + 1][j + 2]) fl = 0;
  return fl;
}
void go(int i, int j, int k) {
  if (i == n - 1 && j == m) {
    if (k > maxx) {
      maxx = k - 1;
      if (maxx == ans[n][m] || maxx == ans[m][n]) {
        cout << maxx << "\n";
        for (int i = 0; i < n; ++i) {
          for (int j = 0; j < m; ++j)
            if (a[i][j] == 0)
              cout << '.';
            else
              cout << (char)(a[i][j] + 'A' - 1);
          cout << "\n";
        }
        exit(0);
      }
      for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j) best[i][j] = a[i][j];
    }
    return;
  }
  if (j == m) {
    j = 0;
    i++;
  }
  if (m - j < 3) {
    go(i, j + 1, k);
    return;
  }
  if (n - i < 3) {
    go(i, j + 1, k);
    return;
  }
  if (i > n / 2 && maxx / 2 > k) return;
  if (ok1(i, j)) {
    a[i][j] = k;
    a[i][j + 1] = k;
    a[i][j + 2] = k;
    a[i + 1][j + 1] = k;
    a[i + 2][j + 1] = k;
    go(i, j + 1, k + 1);
    a[i][j] = 0;
    a[i][j + 1] = 0;
    a[i][j + 2] = 0;
    a[i + 1][j + 1] = 0;
    a[i + 2][j + 1] = 0;
  }
  if (ok2(i, j)) {
    a[i + 1][j + 2] = k;
    a[i][j + 2] = k;
    a[i + 1][j + 1] = k;
    a[i + 2][j + 2] = k;
    a[i + 1][j] = k;
    go(i, j + 1, k + 1);
    a[i + 1][j + 2] = 0;
    a[i][j + 2] = 0;
    a[i + 1][j + 1] = 0;
    a[i + 2][j + 2] = 0;
    a[i + 1][j] = 0;
  }
  if (ok3(i, j)) {
    a[i + 2][j] = k;
    a[i + 2][j + 1] = k;
    a[i + 2][j + 2] = k;
    a[i + 1][j + 1] = k;
    a[i][j + 1] = k;
    go(i, j + 1, k + 1);
    a[i + 2][j] = 0;
    a[i + 2][j + 1] = 0;
    a[i + 2][j + 2] = 0;
    a[i + 1][j + 1] = 0;
    a[i][j + 1] = 0;
  }
  if (ok4(i, j)) {
    a[i][j] = k;
    a[i + 1][j] = k;
    a[i + 2][j] = k;
    a[i + 1][j + 1] = k;
    a[i + 1][j + 2] = k;
    go(i, j + 1, k + 1);
    a[i][j] = 0;
    a[i + 1][j] = 0;
    a[i + 2][j] = 0;
    a[i + 1][j + 1] = 0;
    a[i + 1][j + 2] = 0;
  }
  go(i, j + 1, k);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) ans[i][j] = -1;
  ans[7][9] = 10;
  ans[9][9] = 13;
  ans[9][8] = 12;
  ans[6][9] = 8;
  ans[5][9] = 7;
  ans[4][9] = 5;
  ans[8][8] = 10;
  go(0, 0, 1);
  cout << maxx << "\n";
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j)
      if (best[i][j] == 0)
        cout << '.';
      else
        cout << (char)(best[i][j] + 'A' - 1);
    cout << "\n";
  }
  return 0;
}