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.*;
import java.math.*;

public class Solution implements Runnable {
        private BufferedReader in;
        private PrintWriter out;
        private StringTokenizer st;
        private Random rnd;
        
        /*String[][] vars = {{"###", ".#.", ".#."}, {"..#", "###", "..#"}, {".#.", ".#.", "###"}, {"#..", "###", "#.."}};
        int n, m;
        final long p = 43;
        Field ans = null;
        HashSet<Long> set = new HashSet<Long>();
        long its = 0;
        long border = 10000000L;
        
        private void rec(Field cur, char letter) {
                ++its;
                if(its >= border) return;
                
                if(ans == null || cur.already > ans.already) {
                        ans = cur;
                }
                
                long hash = cur.getHash();
                if(set.contains(hash)) return;
                set.add(hash);

                
                char next = (char) (letter + 1);
                
                for(int i = 0; i <= n - 3; i++) {
                        for(int j = 0; j <= m - 3; j++) {
                                for(int k = 0; k < 4; k++) {
                                        if(cur.check(i, j, k)) {
                                                Field newField = new Field();
                                                newField.copy(cur);
                                                newField.place(i, j, k, letter);
                                                rec(newField, next);
                                        }
                                }
                        }
                }
        }
        
        class Field {
                char[][] f;
                int already;
                
                Field() {
                        f = new char[n][m];
                        already = 0;
                }
                
                public void copy(Field another) {
                        this.already = another.already;
                        
                        for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) this.f[i][j] = another.f[i][j];
                }
                
                public boolean check(int x, int y, int k) {
                        for(int i = 0; i < 3; i++) {
                                for(int j = 0; j < 3; j++) {
                                        if(f[x + i][y + j] >= 'A' && vars[k][i].charAt(j) != '.') return false;
                                }
                        }
                        return true;
                }
                
                public void place(int x, int y, int k, char letter) {
                        ++already;
                        
                        for(int i = 0; i < 3; i++) {
                                for(int j = 0; j < 3; j++) {
                                        if(vars[k][i].charAt(j) == '#') {
                                                f[x + i][y + j] = letter;
                                        }
                                }
                        }
                }
                
                public long getHash() {
                        long res = 0, mod = 1, cur = 1;
                        
                        for(int i = 0; i < n; i++) {
                                for(int j = 0; j < m; j++) {
                                        if(f[i][j] >= 'A') {
                                                res += cur * mod;
                                        }
                                        
                                        ++cur;
                                        mod *= p;
                                }
                        }
                        
                        return res;
                }
        }
        
        private void solve(int n, int m) {
                ans = null;
                set.clear();
                its = 0;
                
                this.n = n;
                this.m = m;
                
                Field start = new Field();
                
        rec(start, 'A');
        
        out.print("res[" + n + "][" + m + "] = ");
        out.print("\"" + ans.already + "\\n");
        
        for(int i = 0; i < n; i++) {
                for(int j = 0; j < m; j++) {
                        if(ans.f[i][j] >= 'A') out.print(ans.f[i][j]);
                        else out.print('.');
                }
                out.print("\\n");
        }
        out.println("\";");
        }*/
        
        String[][] res = new String[10][10];

    public void solve() throws IOException {
        /*for(int n = 1; n <= 9; n++) {
                for(int m = 1; m <= 9; m++) {
                        solve(n, m);
                }
        }*/
        
        res[1][1] = "0\n.\n";
        res[1][2] = "0\n..\n";
        res[1][3] = "0\n...\n";
        res[1][4] = "0\n....\n";
        res[1][5] = "0\n.....\n";
        res[1][6] = "0\n......\n";
        res[1][7] = "0\n.......\n";
        res[1][8] = "0\n........\n";
        res[1][9] = "0\n.........\n";
        res[2][1] = "0\n.\n.\n";
        res[2][2] = "0\n..\n..\n";
        res[2][3] = "0\n...\n...\n";
        res[2][4] = "0\n....\n....\n";
        res[2][5] = "0\n.....\n.....\n";
        res[2][6] = "0\n......\n......\n";
        res[2][7] = "0\n.......\n.......\n";
        res[2][8] = "0\n........\n........\n";
        res[2][9] = "0\n.........\n.........\n";
        res[3][1] = "0\n.\n.\n.\n";
        res[3][2] = "0\n..\n..\n..\n";
        res[3][3] = "1\nAAA\n.A.\n.A.\n";
        res[3][4] = "1\nAAA.\n.A..\n.A..\n";
        res[3][5] = "2\nAAA.B\n.ABBB\n.A..B\n";
        res[3][6] = "2\nAAA.B.\n.ABBB.\n.A..B.\n";
        res[3][7] = "3\nAAABCCC\n.A.B.C.\n.ABBBC.\n";
        res[3][8] = "3\nAAA.BCCC\n.ABBB.C.\n.A..B.C.\n";
        res[3][9] = "4\nAAABCCC.D\n.A.B.CDDD\n.ABBBC..D\n";
        res[4][1] = "0\n.\n.\n.\n.\n";
        res[4][2] = "0\n..\n..\n..\n..\n";
        res[4][3] = "1\nAAA\n.A.\n.A.\n...\n";
        res[4][4] = "2\nAAA.\n.AB.\n.AB.\n.BBB\n";
        res[4][5] = "2\nAAA.B\n.ABBB\n.A..B\n.....\n";
        res[4][6] = "3\nAAABBB\n.AC.B.\n.AC.B.\n.CCC..\n";
        res[4][7] = "4\nAAABBB.\n.AC.BD.\n.AC.BD.\n.CCCDDD\n";
        res[4][8] = "4\nAAA.BCCC\n.ABBBDC.\n.A..BDC.\n....DDD.\n";
        res[4][9] = "5\nAAABBBCCC\n.AD.BE.C.\n.AD.BE.C.\n.DDDEEE..\n";
        res[5][1] = "0\n.\n.\n.\n.\n.\n";
        res[5][2] = "0\n..\n..\n..\n..\n..\n";
        res[5][3] = "2\nAAA\n.A.\n.AB\nBBB\n..B\n";
        res[5][4] = "2\nAAA.\n.AB.\n.AB.\n.BBB\n....\n";
        res[5][5] = "4\nAAA.B\n.ABBB\nCA.DB\nCCCD.\nC.DDD\n";
        res[5][6] = "4\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\n..C..D\n";
        res[5][7] = "5\nAAA.B..\n.ABBBC.\nDA.EBC.\nDDDECCC\nD.EEE..\n";
        res[5][8] = "6\nAAA.BCCC\n.ABBBDC.\nEA.FBDC.\nEEEFDDD.\nE.FFF...\n";
        res[5][9] = "7\nAAA.BCCC.\n.ABBBDC..\nEA.FBDCG.\nEEEFDDDG.\nE.FFF.GGG\n";
        res[6][1] = "0\n.\n.\n.\n.\n.\n.\n";
        res[6][2] = "0\n..\n..\n..\n..\n..\n..\n";
        res[6][3] = "2\nAAA\n.A.\n.AB\nBBB\n..B\n...\n";
        res[6][4] = "3\nAAA.\n.AB.\n.AB.\nCBBB\nCCC.\nC...\n";
        res[6][5] = "4\nAAA.B\n.ABBB\n.AC.B\nCCCD.\n..CD.\n..DDD\n";
        res[6][6] = "5\nAAA.B.\n.ABBB.\n.A.CB.\nDCCCE.\nDDDCE.\nD..EEE\n";
        res[6][7] = "6\nAAABCCC\n.A.B.C.\nDABBBCE\nDDDFEEE\nDFFF..E\n...F...\n";
        res[6][8] = "7\nAAA.BCCC\n.ABBBDC.\n.AE.BDC.\nEEEFDDDG\n..EF.GGG\n..FFF..G\n";
        res[6][9] = "8\nAAA.BCCC.\n.ABBB.C..\n.A.DBEC..\nFDDDGEEEH\nFFFDGEHHH\nF..GGG..H\n";
        res[7][1] = "0\n.\n.\n.\n.\n.\n.\n.\n";
        res[7][2] = "0\n..\n..\n..\n..\n..\n..\n..\n";
        res[7][3] = "3\nAAA\n.A.\n.AB\nBBB\n.CB\n.C.\nCCC\n";
        res[7][4] = "4\nAAA.\n.AB.\n.AB.\nCBBB\nCCCD\nCDDD\n...D\n";
        res[7][5] = "5\nAAA.B\n.ABBB\n.AC.B\nCCCD.\n.ECD.\n.EDDD\nEEE..\n";
        res[7][6] = "6\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\n.EC.FD\n.EFFF.\nEEE.F.\n";
        res[7][7] = "8\nAAABCCC\n.A.B.C.\nDABBBCE\nDDDFEEE\nDG.F.HE\n.GFFFH.\nGGG.HHH\n";
        res[7][8] = "9\nAAA.BBB.\n.ACCCBD.\n.AEC.BD.\nEEECFDDD\nG.EHFFFI\nGGGHFIII\nG.HHH..I\n";
        res[7][9] = "10\nAAA.BC...\n.ABBBCCCD\nEA.FBCDDD\nEEEF.GGGD\nEHFFFIGJ.\n.H.IIIGJ.\nHHH..IJJJ\n";
        res[8][1] = "0\n.\n.\n.\n.\n.\n.\n.\n.\n";
        res[8][2] = "0\n..\n..\n..\n..\n..\n..\n..\n..\n";
        res[8][3] = "3\nAAA\n.A.\n.AB\nBBB\n.CB\n.C.\nCCC\n...\n";
        res[8][4] = "4\nAAA.\n.AB.\n.AB.\nCBBB\nCCCD\nCDDD\n...D\n....\n";
        res[8][5] = "6\nAAA.B\n.ABBB\nCA.DB\nCCCD.\nCEDDD\n.EFFF\nEEEF.\n...F.\n";
        res[8][6] = "7\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\n..CE.D\nFEEEG.\nFFFEG.\nF..GGG\n";
        res[8][7] = "9\nAAAB..C\n.A.BCCC\nDABBBEC\nDDDEEE.\nDFFF.EG\n.HFIGGG\n.HFIIIG\nHHHI...\n";
        res[8][8] = "10\nAAA.BCCC\n.ABBBDC.\nEA.FBDC.\nEEEFDDDG\nEHFFFGGG\n.HIII.JG\nHHHIJJJ.\n...I..J.\n";
        res[8][9] = "12\nA.EEE.JJJ\nAAAEHHHJ.\nAB.EFHKJ.\n.BFFFHKKK\nBBBDFIK..\nCDDDGIIIL\nCCCDGILLL\nC..GGG..L\n";
        res[9][1] = "0\n.\n.\n.\n.\n.\n.\n.\n.\n.\n";
        res[9][2] = "0\n..\n..\n..\n..\n..\n..\n..\n..\n..\n";
        res[9][3] = "4\nAAA\n.A.\n.AB\nBBB\nC.B\nCCC\nC.D\nDDD\n..D\n";
        res[9][4] = "5\nAAA.\n.AB.\n.AB.\nCBBB\nCCCD\nCDDD\nEEED\n.E..\n.E..\n";
        res[9][5] = "7\nAAA.B\n.ABBB\nCA.DB\nCCCD.\nCEDDD\n.EEEF\nGEFFF\nGGG.F\nG....\n";
        res[9][6] = "8\nAAA.B.\n.ABBB.\n.AC.BD\nCCCDDD\nE.CF.D\nEEEF..\nEGFFFH\n.G.HHH\nGGG..H\n";
        res[9][7] = "10\nAAA.B..\n.ABBBC.\n.AD.BC.\nDDDECCC\nF.DEEEG\nFFFEGGG\nFHIIIJG\n.H.I.J.\nHHHIJJJ\n";
        res[9][8] = "12\nAAA.BCCC\n.ABBBDC.\nEA.FBDC.\nEEEFDDDG\nEHFFFGGG\n.HHHIIIG\nJHKKKIL.\nJJJK.IL.\nJ..K.LLL\n";
        res[9][9] = "13\nAAA.BCCC.\n.ABBB.CD.\n.AE.BFCD.\nEEEFFFDDD\nG.E.HFIII\nGGGJHHHI.\nGK.JHL.IM\n.KJJJLMMM\nKKK.LLL.M\n";

        int n = nextInt(), m = nextInt();
        
        out.println(res[n][m]);
    }
                
        public static void main(String[] args) {
                new Solution().run();
        } 
        
        public void run() {
                try {
                        in = new BufferedReader(new InputStreamReader((System.in)));
                        out = new PrintWriter(System.out);
                        
                        st = null;
                        rnd = new Random();
                        
                        double start = System.currentTimeMillis();
                        solve();
                        double total = (System.currentTimeMillis() - start) / 1000.0;
                        total *= 10; // hello intel core i7-2700 4.5 Ghz :D
                        
                        //out.println("Total time: " + total + " sec.");
                        
                        out.close();
                } catch(IOException e) {
                        e.printStackTrace();
                }       
        }
        
        private String nextToken() throws IOException, NullPointerException {
                while(st == null || !st.hasMoreTokens()) {
                        st = new StringTokenizer(in.readLine());
                }
                
                return st.nextToken();
        }
        
        private int nextInt() throws IOException {
                return Integer.parseInt(nextToken());
        }
        
        private long nextLong() throws IOException {
                return Long.parseLong(nextToken());
        }
        
        private double nextDouble() throws IOException {
                return Double.parseDouble(nextToken());
        }

}