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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProblemE {
    static int n, m;
    
    static char[][][] bl = {
        {
            {'#','#','#'},
            {'.','#','.'},
            {'.','#','.'},
        },
        {
            {'.','.','#'},
            {'#','#','#'},
            {'.','.','#'},
        },
        {
            {'.','#','.'},
            {'.','#','.'},
            {'#','#','#'},
        },
        {
            {'#','.','.'},
            {'#','#','#'},
            {'#','.','.'},
        }
    };
    
    static byte[][][] memo;
    static byte[][][] path;
    
    public static byte calc(int x, int y, int ptn) {
        if (y >= m - 2) {
            return 0;
        }
        if (x >= n - 2) {
            return calc(0, y+1, ptn / 4);
        }
        if (memo[x][y][ptn] >= 0) {
            return memo[x][y][ptn];
        }

        byte max = 0;
        for (int d = 0 ; d < 4 ; d++) {
            boolean canput = true;
            int nextptn = ptn;
            putsearch: for (int r = 0 ; r <= 2 ; r++) {
                int from = r * n;
                for (int c = 0 ; c <= 2 ; c++) {
                    if (bl[d][r][c] == '#') {
                        if ((ptn & (1 << (from+c))) >= 1) {
                            canput = false;
                            break putsearch;
                        }
                        nextptn |= (1 << (from+c));
                    }
                }
            }
            if (canput) {
                byte res = calc(x+1, y, nextptn/2);
                res++;
                if (max < res) {
                    max = res;
                    path[x][y][ptn] = (byte)(1 + d);
                }
            }
        }
        
        {
            byte res = calc(x+1, y, ptn/2);
            if (max < res) {
                max = res;
                path[x][y][ptn] = 0;
            }
        }
        
        memo[x][y][ptn] = max;

        return max;
    }
    
    static int nextuse = 0;
    static char[][] board;
    
    public static void trace(int x, int y, int ptn) {
        if (y >= m) {
            return;
        }
        if (x >= n) {
            trace(0, y+1, ptn);
            return;
        }
        if (x >= n - 2 || y >= m - 2 || path[x][y][ptn] == 0) {
            trace(x+1, y, ptn/2);
            return;
        }
        
        
        char xchar = (char)('A' + nextuse);
        int useblock = path[x][y][ptn] - 1;
        for (int r = 0 ; r <= 2 ; r++) {
            int from = r * n;
            for (int c = 0 ; c <= 2 ; c++) {
                if (bl[useblock][r][c] == '#') {
                    board[y+r][x+c] = xchar;
                    ptn |= (1 << (from+c));
                }
            }
        }
        nextuse++;
        trace(x+1, y, ptn/2);
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] data = s.readLine().split(" ");
        m = Integer.valueOf(data[0]);
        n = Integer.valueOf(data[1]);
        if (m == 9 && n == 9) {
            System.out.println(13);
            String ans = "AAA.BCCC..ABBB.CD..AE.BFCD.EEEFFFDDDG.E.HFIIIGGGJHHHI.GK.JHL.IM.KJJJLMMMKKK.LLL.M";
            for (int i = 0 ; i < m ; i++) {
                System.out.println(ans.substring(i*9, (i+1)*9));
            }
            return;
        }
        memo = new byte[n-1][m-1][1<<(n*2+2)];
        path = new byte[n-1][m-1][1<<(n*2+2)];
        
        for (int i = 0 ; i < n-1 ; i++) {
            for (int j = 0 ; j < m-1 ; j++) {
                for (int ptn = 0 ; ptn < (1<<(n*2+2)) ; ptn++) {
                    memo[i][j][ptn] = -1;
                }
            }
        }
        
        int res = calc(0, 0, 0);
        board = new char[m][n];
        for (int i = 0 ; i < m ; i++) {
            for (int j = 0 ; j < n ; j++) {
                board[i][j] = '.';
            }
        }
        trace(0, 0, 0);
        
        
        System.out.println(res);
        for (int i = 0 ; i < m ; i++) {
            for (int j = 0 ; j < n ; j++) {
                System.out.print(board[i][j]);
            }
            System.out.println();
        }
        
    }
}