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 JAVA):

Solution:
import java.util.Scanner;


public class C {
    static final Scanner sc = new Scanner(System.in);
    static int[][] board, resb;
    static int n, m, res;
    static boolean[][][] p = new boolean[4][3][3];
    
    static boolean can(int x, int y, int i) {
        for(int dy = 0; dy < 3; dy++)
            for(int dx = 0; dx < 3; dx++)
                if(p[i][dy][dx] && board[y+dy][x+dx] != 0)
                    return false;
        return true;
    }
    
    static void put(int x, int y, int i, int v) {
        for(int dy = 0; dy < 3; dy++)
            for(int dx = 0; dx < 3; dx++)
                if(p[i][dy][dx])
                    board[y+dy][x+dx] = v;
    }
    
    static void check(int v) {
        if(res + 1 < v) {
            res = v - 1;
//          System.out.println(res);
            for(int y = 0; y < n; y++)
                for(int x = 0; x < m; x++)
                    resb[y][x] = board[y][x];
        }
    }
    
    static int[][] border;
    static void dfs(int x, int y, int t) {
        if(y + 2 >= n) { check(t); return; }
        if(x + 2 >= m) { if(res == -1 || border[n-y-1][m] + t - 1 > res) dfs(0, y+1, t); return; }
        for(int i = 0; i < 4; i++) {
            if(can(x, y, i)) {
                put(x, y, i, t);
                dfs(x + 1, y, t + 1);
                put(x, y, i, 0);
            }
        }
        dfs(x+1, y, t);
    }

    static char[][][][] resboard = new char[10][10][][];
    static void doit() {
        resboard[n][m] = new char[n][m];
        board = new int[n][m];
        resb = new int[n][m];
        for(int i = 0; i < 3; i++) p[0][0][i] = p[0][i][1] = true;
        for(int i = 0; i < 3; i++) p[1][i][0] = p[1][1][i] = true;
        for(int i = 0; i < 3; i++) p[2][2][i] = p[2][i][1] = true;
        for(int i = 0; i < 3; i++) p[3][i][2] = p[3][1][i] = true;
        res = -1;
        dfs(0, 0, 1);
//      System.out.println(n + " " + m);
//      System.out.println(res);
        border[n][m] = res;
        for(int y = 0; y < n; y++) {
            for(int x = 0; x < m; x++)
//              System.out.print(resb[y][x] == 0 ? '.' : (char)(resb[y][x] + 'A' - 1));
                resboard[n][m][y][x] = resb[y][x] == 0 ? '.' : (char)(resb[y][x] + 'A' - 1);
//          System.out.println();
        }
    }
    
    public static void main(String[] args) {
        final int nn = sc.nextInt();
        final int mm = sc.nextInt();
        border = new int[10][10];
        for(m = 1; m <= mm; m++) {
            for(n = 1; n <= nn; n++) {
                doit();
            }
        }
        n = nn; m = mm;
        /*
        if(n == 8 && m == 7) {
            System.out.println(9);
            System.out.println("AAAB..C");
            System.out.println(".A.BCCC");
            System.out.println("DABBBEC");
            System.out.println("DDDEEE.");
            System.out.println("DFFF.EG");
            System.out.println(".HFIGGG");
            System.out.println(".HFIIIG");
            System.out.println("HHHI...");
        } else if(n == 5 && m == 5) {
            System.out.println(4);
        } else*/ {
            System.out.println(border[n][m]);
            for(int y = 0; y < n; y++) {
                for(int x = 0; x < m; x++)
                    System.out.print(resboard[n][m][y][x]);
                System.out.println();
            }
        }
    }
}