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.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.IOException;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AlexFetisov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC_HelpSklad solver = new TaskC_HelpSklad();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC_HelpSklad {
        public static final String[] strings = new String[]{
                ".", "..", "...", "....", ".....", "......", ".......", "........", ".........", "..", "....", "......", "........", "..........", "............", "..............", "................", "..................", "...", "......", "..AAAA..A", "...A.AAA...A", ".A..B.ABBBAAA.B", "..A..BAAABBB..A..B", ".ABBB.C.A.BCCCAAAB..C", "..B.A..CBBB.ACCC..BAAA.C", ".ABBBC..D.A.B.CDDDAAABCCC.D", "....", "........", ".....AAAA..A", "...BABBBAAABA...", "....B.ABBB.AAAB.A...", "...B..ABBBC.AAABC.A..CCC", "...CAAABCCCDA.BBBCDA.B..DDD.", "...B...DABBBCDDDAAABCCCDA...C...", "...C.AAA.BCCCD.AE.BBBCD.AE.B..DDDEEE", ".....", "..........", "..AAAA.BA.B.BBB", ".......BABBBAAABA...", "AAA.B.ABBBCA.DBCCCD.C.DDD", "..A...AAABBBC.ADB.CCCDB.C.DDD.", "..A...CAAABCCC.DAB.EC.DBBBE.DDD.EEE", "..B..AAABBBCCCA.D.BEC.AFDDDECFFFD.EEE..F", "..C.A.BBBCCCDAAAB..ECDAF.BG.EDDDFGGGEEE.FFF.G", "......", "............", ".....AAAA.BA.B.BBB", "...A.AAABBBA.BC..BC..CCC", "....B.ABBB.AAABCA.D.CCCD.C.DDD", ".....BAAABBB.ACCCB.AECD.EEECD...EDDD", "...B...ABBB..CAAABCCCADEEEFC.D.E.F.DDDEFFF", ".......CA.BBBCCCAAABDDDCAE.BGDF..EGGGDF.EEE.GFFF", ".....CAAABBBCCCDA..BEEECDA..BGEFDDDHGGGEF.HHH..GFFF..H", ".......", "..............", "..AAAAB.ABBBB.CCCC..C", "...BABBBAAABA..DCDDDCCCDC...", "...A..AAA.BBBAC.BCCCDB.ECDDDE.D.EEE", "...B..ABBBC.AAABC.A.DCCC.EDDDF.EDFFFEEE..F", "AAA.BBB.ACCCB..AECDB.EEECDDDF.EGD.HFFFGHHHF.GGG.H", ".AAA.BBB.CADDDB..CA.DEB.CCCGDEEEFGGGHE.IFFFGHIIIF..HHH.I", "...BAAA.C.BBB.ACCCDDDBFAE.C.DFFFGEEEHD.IFGEJ.HHHIGGGJ.H.III.JJJ", "........", "................", ".....AAAAB.ABBBB.CCCC..C", ".......BABBBAAABA..DCDDDCCCDC...", "....B.ABBB.AAABCADDDCCCD.CE.DF.EFFFEEE.F", "...B..ABBBC.AAABC.A.DCCCDDDEEEF.DGE.FFFGE.F.GGG.", "...CAAABCCCDA.BBBCDA.B.EDDDGEEEFGGG.HEF.IG.HFFFI.HHH.III", "....B..CA.BBBCCCAAADB.ECA.FDDDE.FFFDGEEEH.FIGGGJHHHIGJJJH.III..J", "...CAAA.EBCCCDAEEEBBBCDAF.EB.GDDDFFFGGGHHHF.LI.GJHKLLLIIIJHKKKLI.JJJK...", ".........", "..................", "..AAAAB.ABBBB.CCCC.DC.D.DDD", "...A.AAABBBA.BC..BC.DCCCDDDEDEEE...E", "....BA.BBBAAACBACCC.DDDCE.DEEEFD.GEFFFG.F.GGG", ".....BAAABBB.ACCCBDA.CE.DDDCE.D.FEEE.GFFFH.GFHHHGGG..H", "...B..CABBBCCCAAABD.CA..FDDDEFFFD.GEEEFGGGEHIIIJG.H.I.J.HHHIJJJ", ".AAABCCC.DA.B.C..DABBBCFDDDHEFFFGHHHEEEFGGGHEIIIGJKKKLI..J.K.LI.JJJKLLL.",
                "..A...C..AAABCCCD.E.ABBBCD.EEEBHFDDDEGHHHFFFI.GGGHFIIIJG.KLLLMIJJJK.L.M.J.KKKLMMM"
        };
        public static final int[] res = new int[]{
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 0, 0, 1, 2, 2, 3, 4, 4, 5, 0, 0, 2, 2, 4, 4, 5, 6, 7, 0, 0, 2, 3, 4, 5, 6, 7, 8, 0, 0, 3, 4, 5, 6, 8, 9, 10, 0, 0, 3, 4, 6, 7, 9, 10, 12, 0, 0, 4, 5, 7, 8, 10, 12,
                13
        };

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int cnt = 0;
            for (int i = 1; i <= 9; ++i) {
                for (int j = 1; j <= 9; ++j) {
                    if (i == n && j == m) {
                        out.println(res[cnt]);
                        String s = strings[cnt];
                        int ptr = 0;
                        for (int k = 0; k < n; ++k) {
                            for (int p = 0; p < m; ++p) {
                                out.print(s.charAt(ptr++));
                            }
                            out.println();
                        }
                        return;
                    }
                    ++cnt;
                }
            }
//        List<Integer> results = new ArrayList<Integer>();
//        for (n = 1; n <= 9; ++n) {
//            //best = 0;
//            for (m = 1; m <= 9; ++m) {
//                if (n == 9 && m == 9) break;
//                field = new int[n][m];
//                bestField = new int[n][m];
//                best = 0;
//                rec(0, 0, 1);
//                // out.println(best);
//                results.add(best);
//                for (int i = 0; i < n; ++i) {
//                    for (int j = 0; j < m; ++j) {
//                        if (bestField[i][j] == 0) {
//                            out.print('.');
//                        } else {
//                            out.print((char) (bestField[i][j] - 1 + 'A'));
//                        }
//                    }
//                    //out.println();
//                }
//                out.print(',');
//                out.flush();
//                System.err.println(n + " " + m + " " + "DONE!");
//                System.err.flush();
//            }
//        }
//        out.println();
//        for (int x : results) {
//            out.print(x);
//            out.print(",");
//        }
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String nextString() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}