#include <bits/stdc++.h>
using namespace std;
const int d[4][5][2] = {0, 0, 1, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 1,
                        0, 2, 1, 1, 2, 1, 0, 2, 1, 0, 1, 1, 1, 2,
                        2, 2, 0, 1, 1, 1, 2, 0, 2, 1, 2, 2};
int i, j, k, l, n, m, ans;
char a[11][11], s[11][11];
bool check(int x, int y) {
  if (x < 1 || x > n || y < 1 || y > m) return 0;
  return a[x][y] == '.';
}
void dfs(int x, int y, int t, int w) {
  if (y == m + 1) {
    x++;
    y = 1;
  }
  if (t + w / 5 <= ans) return;
  if (x == n + 1) {
    memcpy(s, a, sizeof(s));
    ans = t;
    return;
  }
  int i, j;
  for (i = 0; i < 4; ++i) {
    for (j = 0; j < 5; ++j)
      if (!check(x + d[i][j][0], y + d[i][j][1])) break;
    if (j == 5) {
      for (j = 0; j < 5; ++j) a[x + d[i][j][0]][y + d[i][j][1]] = t + 65;
      dfs(x, y + 1, t + 1, w - 5 - (a[x][y] == '.'));
      for (j = 0; j < 5; ++j) a[x + d[i][j][0]][y + d[i][j][1]] = '.';
    }
  }
  dfs(x, y + 1, t, w - (a[x][y] == '.'));
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) a[i][j] = '.';
  ans = -1;
  dfs(1, 1, 0, n * m);
  cout << ans << "\n";
  for (i = 1; i <= n; ++i) cout << s[i] + 1 << "\n";
}
