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;
void require(bool cond, const string& message = "Runtime error") {
  if (!cond) {
    cerr << message << endl;
    assert(false);
  }
}
vector<vector<string> > fs;
vector<int> dx;
vector<int> dy;
int n, m;
bool used[10][10];
int ans = -1;
vector<string> fans;
char cur[10][10];
int shift[4];
void readData() {
  shift[0] = 3;
  shift[1] = 1;
  shift[2] = 1;
  shift[3] = 2;
  cin >> n >> m;
  vector<string> t1;
  t1.push_back("###");
  t1.push_back(".#.");
  t1.push_back(".#.");
  fs.push_back(t1);
  dx.push_back(0);
  dy.push_back(0);
  vector<string> t2;
  t2.push_back("..#");
  t2.push_back("###");
  t2.push_back("..#");
  fs.push_back(t2);
  dx.push_back(0);
  dy.push_back(2);
  vector<string> t3;
  t3.push_back(".#.");
  t3.push_back(".#.");
  t3.push_back("###");
  fs.push_back(t3);
  dx.push_back(0);
  dy.push_back(1);
  vector<string> t4;
  t4.push_back("#..");
  t4.push_back("###");
  t4.push_back("#...");
  fs.push_back(t4);
  dx.push_back(0);
  dy.push_back(0);
  fans.resize(n, string(m, '.'));
  for (int i = 0; i < int(n); ++i)
    for (int j = 0; j < int(m); ++j) cur[i][j] = '.';
}
inline bool inside(int x, int y) { return x < n && y < m && x >= 0 && y >= 0; }
const int MAX_ITER = 1000 * 1000 * 30;
int iter = 0;
void rec(int x, int y, int cnt) {
  ++iter;
  if (iter >= MAX_ITER) return;
  if (y >= m) {
    y = 0;
    ++x;
  }
  if (x == n) {
    if (cnt > ans) {
      ans = cnt;
      for (int i = 0; i < int(n); ++i)
        for (int j = 0; j < int(m); ++j) fans[i][j] = cur[i][j];
    }
    return;
  }
  if (!used[x][y] && x + 3 <= n) {
    for (int i = 0; i < int(4); ++i) {
      bool ok = true;
      for (int x1 = 0; x1 < int(3); ++x1) {
        for (int y1 = 0; y1 < int(3); ++y1) {
          int xx = x - dx[i] + x1;
          int yy = y - dy[i] + y1;
          if (fs[i][x1][y1] == '.') continue;
          if (!inside(xx, yy) || used[xx][yy]) {
            ok = false;
            break;
          }
        }
      }
      if (!ok) continue;
      for (int x1 = 0; x1 < int(3); ++x1) {
        for (int y1 = 0; y1 < int(3); ++y1) {
          int xx = x - dx[i] + x1;
          int yy = y - dy[i] + y1;
          if (fs[i][x1][y1] == '.') continue;
          used[xx][yy] = true;
          cur[xx][yy] = char(cnt + 'A');
        }
      }
      rec(x, y + shift[i], cnt + 1);
      for (int x1 = 0; x1 < int(3); ++x1) {
        for (int y1 = 0; y1 < int(3); ++y1) {
          int xx = x - dx[i] + x1;
          int yy = y - dy[i] + y1;
          if (fs[i][x1][y1] == '.') continue;
          cur[xx][yy] = '.';
          used[xx][yy] = false;
        }
      }
    }
  }
  rec(x, y + 1, cnt);
}
void solve() {
  if (n == 9 && m == 9) {
    cout << 13 << endl;
    cout << "AAABBBCCC\n"
         << ".AD.BE.C.\n"
         << ".AD.BE.C.\n"
         << "FDDDEEE.G\n"
         << "FFFHHHGGG\n"
         << "FIIIHJJJG\n"
         << ".KILH.JM.\n"
         << ".KILLLJM.\n"
         << "KKKL..MMM\n";
    return;
  }
  if (n == 8 && m == 9) {
    cout << 12 << endl;
    cout << "AAABBB..C\n"
         << ".AD.BECCC\n"
         << ".AD.BEEEC\n"
         << "FDDDGEHHH\n"
         << "FFFIGGGH.\n"
         << "FJ.IGK.HL\n"
         << ".JIIIKLLL\n"
         << "JJJ.KKK.L\n";
    return;
  }
  if (n == 9 && m == 8) {
    cout << 12 << endl;
    cout << "AAABBB.C\n"
         << ".AD.BCCC\n"
         << ".AD.B.EC\n"
         << "FDDDEEE.\n"
         << "FFFGGGEH\n"
         << "FIIIGHHH\n"
         << ".JIKG.LH\n"
         << ".JIKKKL.\n"
         << "JJJK.LLL\n";
    return;
  }
  rec(0, 0, 0);
  cout << ans << endl;
  for (int i = 0; i < int(n); ++i) {
    cout << fans[i] << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  readData();
  solve();
  return 0;
}