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.*;
import java.util.*;
public class C {
    
    int m, n, kq;
    char[][] ans;
    char[][] out;
    char[][][] p = new char[4][3][3];
    final public void solve() throws IOException {
        m = nextInt();
        n = nextInt();
        ans = new char[m][n];
        out = new char[m][n];
        for (int i = 0; i < m; i++)
            for (int j = 0; j < n; j++)
                ans[i][j] = '.';
        
        p[0][0][0] = '#';
        p[0][0][1] = '#';
        p[0][0][2] = '#';
        p[0][1][0] = '.';
        p[0][1][1] = '#';
        p[0][1][2] = '.';
        p[0][2][0] = '.';
        p[0][2][1] = '#';
        p[0][2][2] = '.';
        
        for (int k = 1; k < 4; k++)
            for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++)
                    p[k][i][j] = p[k - 1][2 - j][i];
        
        kq = -1;
        go(0, 0, 0);
        writer.println(kq);
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++)
                writer.print(out[i][j]);
            writer.println();
        }
    }
    
    private void go(int i, int j, int cnt) {
        if (i >= m - 2) {
            if (cnt > kq) {
                kq = cnt;
                for (int x = 0; x < m; x++)
                    for (int y = 0; y < n; y++)
                        out[x][y] = ans[x][y];
            }
            
            return;
        }
        if (j >= n - 2) {
            go(i + 1, 0, cnt);
            return;
        }
        boolean has = false;
        for (int k = 0; k < 4; k++) {
            boolean ok = true;
            for (int x = 0; x < 3; x++) {
                for (int y = 0; y < 3; y++) {
                    int curx = i + x;
                    int cury = j + y;
                    if (curx >= m || cury >= n || (p[k][x][y] != '.' && ans[curx][cury] != '.')) {
                        ok = false;
                        break;
                    }
                }
                if (!ok) break;
            }
            if (ok) {
                has = true;
                for (int x = 0; x < 3; x++)
                    for (int y = 0; y < 3; y++)
                        if (p[k][x][y] == '#') {
                            int curx = i + x;
                            int cury = j + y;
                            ans[curx][cury] = (char)('A' + cnt);
                        }
                go(i, j + 1, cnt + 1);
                for (int x = 0; x < 3; x++)
                    for (int y = 0; y < 3; y++)
                        if (p[k][x][y] == '#') {
                            int curx = i + x;
                            int cury = j + y;
                            ans[curx][cury] = '.';
                        }
            }       
        }
        if (!has) go(i, j + 1, cnt);
        else
            if (Math.random() < 0.6) go(i, j + 1, cnt);
    }

    public static void main(String[] args) throws FileNotFoundException {
        new C().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    final public void run() {
        try {
            long tbegin = System.currentTimeMillis();
            reader = new BufferedReader(new InputStreamReader(System.in));
            //reader = new BufferedReader(new InputStreamReader(new FileInputStream("fselect.inp")));
            tokenizer = null;
            writer = new PrintWriter(new OutputStreamWriter(System.out));
            //writer = new PrintWriter(new FileOutputStream("fselect.out"));
            solve();
            //reader.close();
            //System.out.println(System.currentTimeMillis() - tbegin + "ms...");
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    final int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    final long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    final double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    final String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}