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;
inline void err(istringstream *iss) {}
template <typename T, typename... Args>
void err(istringstream *iss, const T &$val, const Args &...args) {
  string $name;
  *iss >> $name;
  if ($name.back() == ',') $name.pop_back();
  cout << $name << " = " << $val << "; ", err(iss, args...);
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
int n, m, K, T, Q, cn;
struct bitmask {
  int m;
  bool get(const int &posFromRight) { return (1u & (m >> posFromRight)); }
  void set(const int &posFromRight) { m |= (1u << posFromRight); }
  int getSet(const int &posFromRight) { return m | (1u << posFromRight); }
  void reset(const int &posFromRight) { m &= ~(1u << posFromRight); }
  int getReset(const int &posFromRight) { return m & ~(1u << posFromRight); }
  void toggle(const int &posFromRight) { m ^= (1u << posFromRight); }
  int getToggle(const int &posFromRight) { return m ^ (1u << posFromRight); }
  void assignBit(const int &posFromRight, bool val) {
    m ^= ((-(int)val ^ m) & (1u << posFromRight));
  }
  int getAssignBit(const int &posFromRight, bool val) {
    return m ^ ((-(int)val ^ m) & (1u << posFromRight));
  }
  int leadingZeroes() { return m == 0 ? 32 : __builtin_clz(m); }
  int trailingZeroes() { return m == 0 ? 32 : __builtin_ctz(m); }
  int leadingOnes() {
    int temp = ~m;
    return temp == 0 ? 32 : __builtin_clz(temp);
  }
  int trailingOnes() {
    int temp = ~m;
    return temp == 0 ? 32 : __builtin_ctz(temp);
  }
  int cntSetBits() { return __builtin_popcount(m); }
  int LSBIndex() { return __builtin_ffs(int(m)) - 1; }
  int MSBIndex() { return !m ? -1 : __builtin_clz(m) ^ 31; }
  bool isAllSet(int _n) { return m == ((1 << _n) - 1); }
  int LSB() { return (m & -m); }
  int next_popcount() {
    int c = LSB();
    int r = m + c;
    return (((r ^ m) >> 2) / c) | r;
  }
  int prev_popcount() {
    int t = m + 1;
    int v = t & m;
    return v - (v & -v) / ((t ^ m) + 1);
  }
  int nextLessOrEqualBitsSet() { return m + LSB(); }
  void submaskIter(int &i) { i = (i - 1) & m; }
  void trim(const int &cntBits) { m &= (1 << cntBits) - 1; }
  void print() { cout << bitset<32>(m) << "\n"; }
};
struct tile {
  int dr, dc;
};
vector<tile> t[4] = {{{0, 0}, {0, -1}, {0, -2}, {1, -1}, {2, -1}},
                     {{0, 0}, {-1, 0}, {-2, 0}, {-1, -1}, {-1, -2}},
                     {{0, 0}, {0, -1}, {0, -2}, {-1, -1}, {-2, -1}},
                     {{0, 0}, {0, -1}, {0, -2}, {-1, -2}, {1, -2}}};
char ch = 'A', res[9][9];
inline int cellsTraversed(int r1, int c1, int r2, int c2) {
  return n * c2 + r2 - (n * c1 + r1);
}
int memo[9][9][1 << 9 + 9 + 1 | 1];
char nxt[9][9][1 << 9 + 9 + 1 | 1];
int dp(int r, int c, int msk);
void path(int r, int c, int msk);
inline bool chk(const int &ti, const int &r, const int &c, bitmask bm) {
  bm.m <<= 1;
  for (auto &i : t[ti]) {
    int nr = r + i.dr, nc = c + i.dc;
    if (nr < 0 or nr >= n or nc < 0 or nc >= m or
        bm.get(cellsTraversed(nr, nc, r, c)))
      return 0;
  }
  return 1;
}
inline int addT(const int &ti, const int &r, const int &c, bitmask bm,
                bool isPath = 0) {
  bm.m <<= 1;
  for (auto &i : t[ti]) {
    int nr = r + i.dr, nc = c + i.dc;
    bm.set(cellsTraversed(nr, nc, r, c));
    if (isPath) res[nr][nc] = ch;
  }
  bm.trim(9 + 9 + 1);
  if (isPath) return ch++, path(r + 1, c, bm.m), 0;
  return 1 + dp(r + 1, c, bm.m);
}
int dp(int r, int c, int msk) {
  if (c == m) return 0;
  if (r == n) return dp(0, c + 1, msk);
  int &ret = memo[r][c][msk];
  if (ret != -1) return ret;
  ret = 0;
  char &nx = nxt[r][c][msk];
  bitmask bm{msk};
  bm.m <<= 1, bm.trim(9 + 9 + 1);
  ret = dp(r + 1, c, bm.m);
  for (char i = 0; i < 4; i++) {
    if (!chk(i, r, c, {msk})) continue;
    int os = addT(i, r, c, {msk});
    if (os > ret) ret = os, nx = i;
  }
  return ret;
}
void path(int r, int c, int msk) {
  if (c == m) return;
  if (r == n) return path(0, c + 1, msk);
  char &nx = nxt[r][c][msk];
  bitmask bm{msk};
  if (nx == -1) return bm.m <<= 1, bm.trim(9 + 9 + 1), path(r + 1, c, bm.m);
  addT(nx, r, c, bm, 1);
}
int main() {
  cin.tie(NULL);
  scanf("%d%d", &n, &m);
  memset(memo, -1, sizeof(memo)), memset(nxt, -1, sizeof(nxt));
  printf("%d\n", dp(0, 0, (1 << (9 + 9 + 1)) - 1));
  path(0, 0, (1 << (9 + 9 + 1)) - 1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!res[i][j]) res[i][j] = '.';
      printf("%c", res[i][j]);
    }
    printf("\n");
  }
  return 0;
}