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")
using namespace std;
template <typename T>
inline void chkmin(T &x, T y) {
  if (y < x) x = y;
}
template <typename T>
inline void chkmax(T &x, T y) {
  if (y > x) x = y;
}
template <typename T>
inline T add(T x, T y) {
  return (x + y) % 1000000007;
}
template <typename T>
inline T mul(T x, T y) {
  return 1LL * x * y % 1000000007;
}
template <typename T>
inline T qp(T x, T n) {
  T ans = 1;
  do {
    if (n & 1) ans = mul(ans, x);
    x = mul(x, x);
  } while (n >>= 1);
  return ans;
}
const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
inline long long read() {
  long long x = 0;
  int f = 1,
      c = (++pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos);
  for (; !isdigit(c);
       c = (++pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos))
    if (c == '-') f = -f;
  for (; isdigit(c);
       c = (++pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos))
    x = (x << 3) + (x << 1) + (c ^ 48);
  return x * f;
}
const int N = 10;
int n, m;
int has[N][N];
const pair<int, int> shape[4][5] = {
    {make_pair(0, 0), make_pair(0, 1), make_pair(0, 2), make_pair(1, 1),
     make_pair(2, 1)},
    {make_pair(0, 2), make_pair(1, 0), make_pair(1, 1), make_pair(1, 2),
     make_pair(2, 2)},
    {make_pair(0, 1), make_pair(1, 1), make_pair(2, 0), make_pair(2, 1),
     make_pair(2, 2)},
    {make_pair(0, 0), make_pair(1, 0), make_pair(1, 1), make_pair(1, 2),
     make_pair(2, 0)}};
int ans;
int ansboard[N][N];
bool chk(int i, int j, int d) {
  for (int k = 0; k < (int)(5); ++k) {
    int ni = i + shape[d][k].first;
    int nj = j + shape[d][k].second;
    if (ni >= n || nj >= m) return 0;
    if (has[ni][nj]) return 0;
  }
  return 1;
}
void paint(int i, int j, int d, int nw) {
  for (int k = 0; k < (int)(5); ++k) {
    int ni = i + shape[d][k].first;
    int nj = j + shape[d][k].second;
    has[ni][nj] = nw;
  }
}
void dfs(int i, int j, int cnt) {
  if (cnt + 1.0 * (n * m - i * m - j - 1) / 6.5 <= ans) return;
  if (j == m) {
    ++i;
    j = 0;
  }
  if (i == n - 2) {
    if (cnt > ans) {
      ans = cnt;
      for (int i = 0; i < (int)(n); ++i)
        for (int j = 0; j < (int)(m); ++j) ansboard[i][j] = has[i][j];
    }
    return;
  }
  for (int d = 0; d < (int)(4); ++d) {
    if (chk(i, j, d)) {
      paint(i, j, d, cnt + 1);
      dfs(i, j + 1, cnt + 1);
      paint(i, j, d, 0);
    }
  }
  dfs(i, j + 1, cnt);
}
int main() {
  n = read(), m = read();
  dfs(0, 0, 0);
  printf("%d\n", ans);
  for (int i = 0; i < (int)(n); ++i)
    for (int j = 0; j < (int)(m); ++j) {
      printf("%c", ansboard[i][j] ? ansboard[i][j] - 1 + 'A' : '.');
      if (j + 1 == m) puts("");
    }
  return 0;
}