#include <bits/stdc++.h>
using namespace std;
int dd[4][5][2] = {{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {0, -1}},
                   {{0, 0}, {-1, 0}, {-2, 0}, {0, 1}, {0, -1}},
                   {{0, 0}, {0, 1}, {0, 2}, {1, 0}, {-1, 0}},
                   {{0, 0}, {0, -1}, {0, -2}, {1, 0}, {-1, 0}}};
char grf[15][15], grf2[15][15];
int n, m;
int ans;
bool can(int x, int y) {
  return x >= 0 && x < n && y >= 0 && y < m && grf[x][y] == '.';
}
void dfs(int now) {
  if (now > ans) {
    ans = now;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        grf2[i][j] = grf[i][j];
      }
    }
  }
  bool fnd = 0;
  int cntfnd = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (fnd) {
        cntfnd++;
      }
      if (cntfnd > 2) {
        return;
      }
      for (int k = 0; k < 4; k++) {
        bool shit = 0;
        for (int l = 0; l < 5; l++) {
          if (!can(i + dd[k][l][0], j + dd[k][l][1])) {
            shit = 1;
            break;
          }
        }
        if (shit) {
          continue;
        }
        fnd = 1;
        for (int l = 0; l < 5; l++) {
          grf[i + dd[k][l][0]][j + dd[k][l][1]] = now + 'A';
        }
        dfs(now + 1);
        for (int l = 0; l < 5; l++) {
          grf[i + dd[k][l][0]][j + dd[k][l][1]] = '.';
        }
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  memset((char*)grf, '.', sizeof(grf));
  memset((char*)grf2, '.', sizeof(grf2));
  dfs(0);
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << grf2[i][j];
    }
    cout << endl;
  }
  return 0;
}
