142_C. Help Caretaker
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
..
..
```python
n, m = map(int, input().split())
swapped = False
if n < m:
    n, m = m, n
    swapped = True
ans = '' 
if n == 1 and m == 1:
	ans = '''0
.'''
if n == 2 and m == 1:
	ans = '''0
.
.'''
if n == 2 and m == 2:
	ans = '''0
..
..'''
if n == 3 and m == 1:
	ans = '''0
.
.
.'''
if n == 3 and m == 2:
	ans = '''0
..
..
..'''
if n == 3 and m == 3:
	ans = '''1
.A.
.A.
AAA'''
if n == 4 and m == 1:
	ans = '''0
.
.
.
.'''
if n == 4 and m == 2:
	ans = '''0
..
..
..
..'''
if n == 4 and m == 3:
	ans = '''1
.A.
.A.
AAA
...'''
if n == 4 and m == 4:
	ans = '''2
...A
BAAA
BBBA
B...'''
if n == 5 and m == 1:
	ans = '''0
.
.
.
.
.'''
if n == 5 and m == 2:
	ans = '''0
..
..
..
..
..'''
if n == 5 and m == 3:
	ans = '''2
..A
AAA
.BA
.B.
BBB'''
if n == 5 and m == 4:
	ans = '''2
.A..
.A..
AAAB
.BBB
...B'''
if n == 5 and m == 5:
	ans = '''4
BBB.A
.BAAA
DB.CA
DDDC.
D.CCC'''
if n == 6 and m == 1:
	ans = '''0
.
.
.
.
.
.'''
if n == 6 and m == 2:
	ans = '''0
..
..
..
..
..
..'''
if n == 6 and m == 3:
	ans = '''2
.A.
.A.
AAA
.B.
.B.
BBB'''
if n == 6 and m == 4:
	ans = '''3
.A..
.A..
AAAB
CBBB
CCCB
C...'''
if n == 6 and m == 5:
	ans = '''4
.A..B
.ABBB
AAACB
.D.C.
.DCCC
DDD..'''
if n == 6 and m == 6:
	ans = '''5
.A..B.
.ABBB.
AAACB.
ECCCD.
EEECD.
E..DDD'''
if n == 7 and m == 1:
	ans = '''0
.
.
.
.
.
.
.'''
if n == 7 and m == 2:
	ans = '''0
..
..
..
..
..
..
..'''
if n == 7 and m == 3:
	ans = '''3
..A
AAA
B.A
BBB
BC.
.C.
CCC'''
if n == 7 and m == 4:
	ans = '''4
...A
BAAA
BBBA
B..C
DCCC
DDDC
D...'''
if n == 7 and m == 5:
	ans = '''5
.A..B
.ABBB
AAACB
.CCC.
.D.CE
.DEEE
DDD.E'''
if n == 7 and m == 6:
	ans = '''6
.A..B.
.ABBB.
AAACB.
EEECCC
.EDC.F
.EDFFF
.DDD.F'''
if n == 7 and m == 7:
	ans = '''8
B..ACCC
BBBA.C.
BDAAACE
.DDDEEE
GDHHHFE
GGGH.F.
G..HFFF'''
if n == 8 and m == 1:
	ans = '''0
.
.
.
.
.
.
.
.'''
if n == 8 and m == 2:
	ans = '''0
..
..
..
..
..
..
..
..'''
if n == 8 and m == 3:
	ans = '''3
.A.
.A.
AAA
..B
BBB
.CB
.C.
CCC'''
if n == 8 and m == 4:
	ans = '''4
.A..
.A..
AAAB
CBBB
CCCB
CD..
.D..
DDD.'''
if n == 8 and m == 5:
	ans = '''6
.A..B
.ABBB
AAACB
DDDC.
.DCCC
FD.E.
FFFE.
F.EEE'''
if n == 8 and m == 6:
	ans = '''7
.A..B.
.ABBB.
AAA.BC
DDDCCC
.DGGGC
.DFGE.
FFFGE.
..FEEE'''
if n == 8 and m == 7:
	ans = '''9
B..ACCC
BBBA.C.
BDAAACE
.DDDEEE
FD.IIIE
FFFHIG.
FHHHIG.
...HGGG'''
if n == 9 and m == 8:
    ans = '''12
.A..BDDD
.ABBBCD.
AAAEBCD.
FEEECCCG
FFFEHGGG
FKKKHHHG
.IKLH.J.
.IKLLLJ.
IIIL.JJJ'''
if n == 8 and m == 8:
    ans = '''10
.A..BCCC
.A..B.C.
AAABBBCD
E.GGGDDD
EEEGJJJD
EF.GIJH.
.FIIIJH.
FFF.IHHH'''
if n == 9 and m == 9:
    ans = '''13
AAA.BCCC.
.ABBB.CD.
.AE.BFCD.
EEEFFFDDD
G.E.HFIII
GGGJHHHI.
GK.JHL.IM
.KJJJLMMM
KKK.LLL.M'''
if n == 9 and m == 1:
	ans = '''0
.
.
.
.
.
.
.
.
.'''
if n == 9 and m == 2:
	ans = '''0
..
..
..
..
..
..
..
..
..'''
if n == 9 and m == 3:
	ans = '''4
..A
AAA
B.A
BBB
B.C
CCC
.DC
.D.
DDD'''
if n == 9 and m == 4:
	ans = '''5
.A..
.A..
AAAB
CBBB
CCCB
C..D
EDDD
EEED
E...'''
if n == 9 and m == 5:
	ans = '''7
.A..B
.ABBB
AAACB
DCCC.
DDDCF
DEFFF
.E.GF
EEEG.
..GGG'''
if n == 9 and m == 6:
	ans = '''8
.A..B.
.ABBB.
AAACB.
ECCCD.
EEECD.
E.GDDD
.FGGGH
.FGHHH
FFF..H'''
if n == 9 and m == 7:
	ans = '''10
.ACCC.B
.A.CBBB
AAACD.B
...EDDD
FEEED.G
FFFEGGG
FHJJJIG
.H.J.I.
HHHJIII'''
if swapped:
    cnt = ans.split('\n')[0]
    lst = ans.split('\n')[1:]
    ans = ''
    for j in range(m):
        for i in range(n):
            ans = ans + lst[i][j]
        ans += '\n'
    ans = cnt + '\n' + ans
print(ans)




# Made By Mostafa_Khaled
```