#include <bits/stdc++.h>
long long i, j, m, n, s, t, x, y, z, ma;
long long a[100][100], b[100][100];
long long mi(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
void ss(long long x, long long y, long long shu) {
  long long i, j, t;
  z++;
  if (z > 8000000) return;
  if (shu > ma) {
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) b[i][j] = a[i][j];
    ma = shu;
  }
  t = mi(x + 3, n);
  for (i = x; i <= t; i++)
    for (j = 1; j <= m; j++)
      if (a[i][j] == 0) {
        if (a[i][j - 1] + a[i][j + 1] + a[i + 1][j] + a[i + 2][j] == 0 &&
            j - 1 > 0 && j + 1 <= m && i + 2 <= n) {
          a[i][j - 1] = shu + 1;
          a[i][j + 1] = shu + 1;
          a[i][j] = shu + 1;
          a[i + 1][j] = shu + 1;
          a[i + 2][j] = shu + 1;
          ss(i, j, shu + 1);
          a[i][j - 1] = 0;
          a[i][j + 1] = 0;
          a[i][j] = 0;
          a[i + 1][j] = 0;
          a[i + 2][j] = 0;
        }
        if (a[i][j - 1] + a[i][j + 1] + a[i - 1][j] + a[i - 2][j] == 0 &&
            j - 1 > 0 && j + 1 <= m && i - 2 > 0) {
          a[i][j - 1] = shu + 1;
          a[i][j + 1] = shu + 1;
          a[i][j] = shu + 1;
          a[i - 1][j] = shu + 1;
          a[i - 2][j] = shu + 1;
          ss(i, j, shu + 1);
          a[i][j - 1] = 0;
          a[i][j + 1] = 0;
          a[i][j] = 0;
          a[i - 1][j] = 0;
          a[i - 2][j] = 0;
        }
        if (a[i - 1][j] + a[i + 1][j] + a[i][j + 1] + a[i][j + 2] == 0 &&
            i - 1 > 0 && i + 1 <= n && j + 2 <= m) {
          a[i - 1][j] = shu + 1;
          a[i + 1][j] = shu + 1;
          a[i][j] = shu + 1;
          a[i][j + 1] = shu + 1;
          a[i][j + 2] = shu + 1;
          ss(i, j, shu + 1);
          a[i - 1][j] = 0;
          a[i + 1][j] = 0;
          a[i][j] = 0;
          a[i][j + 1] = 0;
          a[i][j + 2] = 0;
        }
        if (a[i - 1][j] + a[i + 1][j] + a[i][j - 1] + a[i][j - 2] == 0 &&
            i - 1 > 0 && i + 1 <= n && j - 2 > 0) {
          a[i - 1][j] = shu + 1;
          a[i + 1][j] = shu + 1;
          a[i][j] = shu + 1;
          a[i][j - 1] = shu + 1;
          a[i][j - 2] = shu + 1;
          ss(i, j, shu + 1);
          a[i - 1][j] = 0;
          a[i + 1][j] = 0;
          a[i][j] = 0;
          a[i][j - 1] = 0;
          a[i][j - 2] = 0;
        }
      }
  return;
}
int main() {
  while (scanf("%lld%lld", &n, &m) != EOF) {
    ma = 0;
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) {
        a[i][j] = 0;
        b[i][j] = 0;
      }
    z = 0;
    ss(1, 1, 0);
    printf("%lld\n", ma);
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++)
        if (b[i][j] == 0)
          printf(".");
        else
          printf("%c", b[i][j] + 64);
      printf("\n");
    }
  }
}
