Problem:
 Score : 500 points    Problem Statement You are given two integers A and B .  Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:   Let the size of the grid be h \times w ( h vertical, w horizontal). Both h and w are at most 100 .  The set of the squares painted white is divided into exactly A connected components.  The set of the squares painted black is divided into exactly B connected components.   It can be proved that there always exist one or more solutions under the conditions specified in Constraints section.
If there are multiple solutions, any of them may be printed.      Notes Two squares painted white, c_1 and c_2 , are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.  A set of squares painted white, S , forms a connected component when the following conditions are met:   Any two squares in S are connected.  No pair of a square painted white that is not included in S and a square included in S is connected.   A connected component of squares painted black is defined similarly.      Constraints  1 \leq A \leq 500  1 \leq B \leq 500         Input Input is given from Standard Input in the following format:  A  B       Output Output should be in the following format:   In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.  Then, print h more lines. The i -th ( 1 \leq i \leq h ) of these lines should contain a string s_i as follows:  If the square at the i -th row and j -th column ( 1 \leq j \leq w ) in the grid is painted white, the j -th character in s_i should be . .  If the square at the i -th row and j -th column ( 1 \leq j \leq w ) in the grid is painted black, the j -th character in s_i should be # .           Sample Input 1 2 3      Sample Output 1 3 3
##.
..#
#.#  This output corresponds to the grid below:          Sample Input 2 7 8      Sample Output 2 3 5
#.#.#
.#.#.
#.#.#       Sample Input 3 1 1      Sample Output 3 4 2
..
#.
##
##       Sample Input 4 3 14      Sample Output 4 8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
#.........#..####.

Solution (Python):
a,b=map(int,input().split())
lists=[list("
lists+=[list("." *100) for i in range(50)]

counter1=0
for i in range(49):
    for j in range(i,95,3):
        if counter1==a-1:
            break
           
        else:
            lists[i][j]="."
            counter1+=1
counter2=0
for i in range(51,100):
    for j in range(i-50,95,3):
        if counter2==b-1:
            break
        else:
            lists[i][j]="
            counter2+=1
print(100,100)
for i in range(100):
    a="".join(lists[i])
    print(a)

Solution (Python):
import sys
input = sys.stdin.buffer.readline

def main():
    N,M = map(int,input().split())
    g_grid = [["
    h_grid = [["." for _ in range(100)] for _ in range(50)]
    
    grid = g_grid + h_grid
    
    N -= 1
    M -= 1
    for i in range(N):
        p = 2*i+1
        x = (p//100)*2
        y = p%100
        grid[x][y] = "."
        
    for i in range(M):
        p = 2*i+1
        x = -(p//100)*2-1
        y = -(p%100)
        grid[x][y] = "
    
    print(100,100)
    
    for i in range(100):
        L = "".join(grid[i])
        print(L)
    
if __name__ == "__main__":
    main()

Solution (Python):
A, B  = map(int, input().split())
grid = []
for h in range(100):
    str = "
    grid.append(list(str))
cntA = 0
while cntA < A - 1:
    w = cntA % 25
    h = cntA // 25
    grid[2*h][2*w] = "."
    cntA += 1
cntB = 0
while cntB < B - 1:
    w = cntB % 25 + 25
    h = cntB // 25  
    grid[2*h][2*w+1] = "
    cntB += 1

print(100,100)
for s in grid:
    print("".join(s))

Solution (Python):
import numpy as np

A, B  = map(int, input().split())
grid = []
for h in range(100):
    str = "
    grid.append(list(str))
cntA = 0
while cntA < A - 1:
    w = cntA % 25
    h = cntA // 25
    grid[2*h][2*w] = "."
    cntA += 1
cntB = 0
while cntB < B - 1:
    w = cntB % 25 + 25
    h = cntB // 25  
    grid[2*h][2*w+1] = "
    cntB += 1

print(100,100)
for s in grid:
    print("".join(s))

Solution (Python):
A,B = map(int, input().split())

h = 100
w = 100
ans = [["
for i in range(h):
    for j in range(w//2):
        ans[i][j] = "."
    
L = [0, 0]
for i in range(B-1):
    r = L[0]
    c = L[1]
    ans[r][c] = "
    L[1] += 2
    if L[1] >= 50:
        L[0] += 2
        L[1] = 0
    
L = [0, 99]
for i in range(A-1):
    r = L[0]
    c = L[1]
    ans[r][c] = "."
    L[1] -= 2
    if L[1] <= 50:
        L[0] += 2
        L[1] = 99
    
print(h, w)
for i in range(h):
    print("".join(ans[i]))

Solution (Python):
import sys

a, b = map(int, sys.stdin.readline().split())

canvas = [['
a -= 1; b -= 1

def paint(color, cnt):
    if color == '.':
        i = j = 0
    else:
        i = 51; j = 0
    
    while cnt:
        canvas[i][j] = color
        cnt -= 1
        j += 2
        if j == 100:
            j = 0
            i += 2

def main(a, b):
    yield '100 100'

    paint('.', a)
    paint('

    for i in range(100):
        yield ''.join(canvas[i])

if __name__ == '__main__':
    ans = main(a, b)
    print(*ans, sep='\n')

Solution (Python):
import sys

a, b = map(int, sys.stdin.readline().split())

def main(a, b):
    h = w = 100
    yield '{0} {1}'.format(h, w)

    if a >= b:
        c1 = '.'
        c2 = '
    else:
        a, b = b, a
        c1 = '
        c2 = '.'

    canvas = [[c2] * w for _ in range(h//2)] + [[c1] * w for _ in range(h//2)]
    a -= 1
    b -= 1

    i = 0
    j = 0
    while a:
        canvas[i][j] = c1
        a -= 1
        j += 2
        if j == 100:
            j = 0
            i += 2
    
    i = 51
    j = 0
    while b:
        canvas[i][j] = c2
        b -= 1
        j += 2
        if j == 100:
            j = 0
            i += 2
        
    for i in range(h):
        yield ''.join(canvas[i])

if __name__ == '__main__':
    ans = main(a, b)
    print(*ans, sep='\n')

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def build_grid(H, W, intv, _type, space=True, padding=False):
    
    if space:
        _input = lambda: input().split()
    else:
        _input = lambda: input()
    _list = lambda: list(map(_type, _input()))
    
    if padding:
        offset = 1
    else:
        offset = 0
    grid = list2d(H+offset*2, W+offset*2, intv)
    for i in range(offset, H+offset):
        row = _list()
        for j in range(offset, W+offset):
            grid[i][j] = row[j-offset]
    return grid

A, B = MAP()


grid = list2d(100, 100, '.')
for i in range(50, 100):
    for j in range(100):
        grid[i][j] = '

A -= 1; B -= 1

for i in range(0, 50, 2):
    for j in range(0, 100, 2):
        if B == 0:
            break
        grid[i][j] = '
        B -= 1
    else:
        continue
    break

for i in range(99, 49, -2):
    for j in range(0, 100, 2):
        if A == 0:
            break
        grid[i][j] = '.'
        A -= 1
    else:
        continue
    break

print(100, 100)
for i in range(100):
    print(''.join(grid[i]))

Solution (Python):
from fractions import gcd

from heapq import*
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7



def lcm(a, b):
    return a * b / fractions.gcd(a, b)


def main():
    a, b = map(int, input().split())
    grid = [["." for i in range(100)] for j in range(100)]
    for i in range(50):
        for j in range(100):
            grid[i][j] = "

    for i in range(0, 50, 2):
        for j in range(0, 100, 2):
            if a == 1:
                break
            grid[i][j] = "."
            a -= 1
        if a == 1:
            break

    for i in range(51, 100, 2):
        for j in range(0, 100, 2):
            if b == 1:
                break
            grid[i][j] = "
            b -= 1

        if b == 1:
            break
    print(100,100)
    for i in range(100):
        print("".join(map(str, grid[i])))
        





if __name__ == '__main__':
    main()

Solution (Python):
a, b = map(int, input().split())

grid = []
for i in range(50):
    line = ['
    grid.append(line)

for i in range(50):
    line = ['.'] * 100
    grid.append(line)

count = 0
for y in range(0, 50, 2):
    for x in range(0, 100, 2):
        if count == a - 1:
            break
        grid[y][x] = '.'
        count += 1
    if count == a - 1:
        break

count = 0
for y in range(51, 100, 2):
    for x in range(0, 100, 2):
        if count == b-1:
            break
        grid[y][x] = '
        count += 1
    if count == b - 1:
        break

print(100, 100)
for line in grid:
    print(''.join(line))

Solution (Python):
import numpy as np

A, B = map(int, input().split())

K = 50
grid = np.ones((100, 100), dtype='int')


grid[:K, :] = 0

A -= 1
col = 0
row = 0
while A:
    if A >= K:
        grid[col, ::2] = 1
        A -= K
        col += 2
        continue

    grid[col, row] = 1
    row += 2
    A -= 1

B -= 1
col = K + 1
row = 0
while B:
    if B >= K:
        grid[col, ::2] = 0
        B -= K
        col += 2
        continue

    grid[col, row] = 0
    row += 2
    B -= 1

grid = np.where(grid, '.', '
print(100, 100)
print('\n'.join(map(''.join, grid.tolist())))

Solution (Python):
import numpy as np

A, B = map(int, input().split())

K = 50
grid = np.ones((100, 100), dtype='int')


grid[:K, :] = 0

A -= 1
col = 0
row = 0
while A:
    if A >= K:
        grid[col, ::2] = 1
        A -= K
        col += 2
        continue

    grid[col, row] = 1
    row += 2
    A -= 1

B -= 1
col = K + 1
row = 0
while B:
    if B >= K:
        grid[col, ::2] = 0
        B -= K
        col += 2
        continue

    grid[col, row] = 0
    row += 2
    B -= 1

grid = np.where(grid, '.', '
print(100, 100)
print('\n'.join(map(''.join, grid)))

Solution (Python):
import numpy as np

A, B = map(int, input().split())

K = 50
grid = np.ones((100, 100), dtype='int')


grid[:K, :] = 0

A -= 1
col = 0
row = 0
while A:
    if A >= K:
        grid[col, ::2] = 1
        A -= K
        col += 2
        continue

    grid[col, row] = 1
    row += 2
    A -= 1

B -= 1
col = K + 1
row = 0
while B:
    if B >= K:
        grid[col, ::2] = 0
        B -= K
        col += 2
        continue

    grid[col, row] = 0
    row += 2
    B -= 1

grid = np.where(grid, '.', '
grid = map(''.join, grid)
print(100, 100)
print('\n'.join(grid))

Solution (Python):
A, B = map(int, input().split())
ans = [[False] * 100 for _ in range(50)] + [[True] * 100 for _ in range(50)]
A -= 1
B -= 1

for h in range(0, 50, 2):
    for w in range(0, 100, 2):
        if A > 0:
            ans[h][w] = True
            A -= 1

for h in range(51, 100, 2)[:: -1]:
    for w in range(0, 100, 2):
        if B > 0:
            ans[h][w] = False
            B -= 1

print(100, 100)
for line in ans:
    a = ['.' if s else '
    print(''.join(a))

Solution (Python):
a,b=map(int,input().split())
a-=1
b-=1
s=[".","
t=["
q=["
p=["."]*100
ans=[]

aaa=a//50
aa=a%50
for i in range(aaa):
    ans.append(s)
    ans.append(t)
x=[".","
ans.append(x)
ans.append(t)
ans.append(p)

bbb=b//50
bb=b%50
for i in range(bbb):
    ans.append(q)
    ans.append(p)
x=["
ans.append(x)

print(len(ans),100)
for u in ans:
    print("".join(u))

Solution (Python):
A, B = map(int, input().split())

g = [["

for i in range(A-1):
    x, y = (i%50)*2, (i//50)*2
    g[y][x] = "."
for i in range(B-1):
    x, y = (i%50)*2, 51+(i//50)*2
    g[y][x] = "

print(100, 100)
for g_i in g:
    print("".join(g_i))

Solution (Python):

import sys


def solve(A: int, B: int):
    
    grid = [["."]*100 for _ in range(50)]+ [["
    A-=1
    B-=1

    
    for i in range(50):
        for j in range(100):
            if i%2 == 0 and j%2 == 0 and B > 0:
                grid[i][j] = "
                B-=1
    
    for i in range(51,100):
        for j in range(100):
            if i%2 == 0 and j%2 == 0 and A>0:
                grid[i][j] = "."
                A-=1
    
    print(100, 100)
    for i in range(100):
        print(''.join(grid[i]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    solve(A, B)

if __name__ == '__main__':
    main()

Solution (Python):
K = 50
A, B = map(int, input().split())
grid = [[0]*(2*K) for i in range(2*K)]
for i in range(K):
  grid[i] = [1]*(2*K)

row = 0
while A>1:
  if row%2==0:
    if A>K:
      grid[row] = [1,0]*K
      A -= K
    else:
      grid[row] = [1,0]*(A-1)+[1,1]*(K-A+1)
      break
  row += 1

row = K+1
while B>1:
  if row%2==0:
    if B>K:
      grid[row] = [1,0]*K
      B -= K
    else:
      grid[row] = [1,0]*(B-1)+[0,0]*(K-B+1)
      break
  row += 1

ans = []
for i in range(2*K):
  s = ''
  for j in range(2*K):
    if grid[i][j] == 1:
      s += '
    else:
      s += '.'
  ans += [s]
print(2*K,2*K)
for i in range(2*K):
  print(ans[i])

Solution (Python):
A, B = map(int, input().split())
lst = [['
for i in range(A-1):
    a, b = divmod(i, 50)
    lst[a*2][b*2] = '.'
for i in range(B-1):
    a, b = divmod(i, 50)
    lst[-1-a*2][-1-b*2] = '
print(100, 100)
for j in lst:
    print(''.join(j))

Solution (Python):
A,B = map(int,input().split())
grid = [['

for i in range(A-1):
    q,r = divmod(i,50)
    grid[q*2][r*2] = '.'
    
for i in range(B-1):
    q,r = divmod(i,50)
    grid[-1-q*2][-1-r*2] = '
    
print(100,100)

for g in grid:
    print(''.join(g))

Solution (Python):
A, B = list(map(int, input().split()))

print(100,100)
for r in range(50):
    if r%2==1: print('
    else:
        for c in range(100):
            if c%2==0 and A>1:
                print('.', end='')
                A-=1
            else:
                print('
        print()

for r in range(50):
    if r%2==0: print('.'*100)
    else:
        for c in range(100):
            if c%2==0 and B>1:
                print('
                B-=1
            else:
                print('.', end='')
        print()

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b=map(int,input().split())
    a-=1; b-=1
    print(100,98)
    h=99
    print('
    while(a>0 or b>0):
        if(a>=24):
            s1='
            a-=24
        else:
            s1='
            a=0
        if(b>=24):
            s2='.
            b-=24
        else:
            s2='.
            b=0
        print(s1+s2)
        h-=1

        print('
        h-=1

    for i in range(h):
        print('

resolve()

Solution (Python):
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]


def gen(k, c0, c1, w):
    ww = w // 2
    w = 2 * ww
    n_rows = k // ww + 1
    remaining = k % ww
    res = []
    line = c1 * w
    for i in range(2 * n_rows):
        if i % 2 == 1:
            res.append(line)
        else:
            i //= 2
            if i != n_rows - 1:
                s = ''.join((c0 + c1) * ww)
            else:
                s = ''.join((c0 + c1) * remaining) + c1 * (w - 2 * remaining)
            res.append(s)
    return res


a, b = ril()
h, w = 100, 100
c0, c1 = '.', '
res = []
res += gen(a - 1, c0, c1, w)
res.append(c0 * w)
if b > 1:
    res += gen(b - 1, c1, c0, w)

print(len(res), w)
for s in res:
    print(s)

Solution (Python):
import math
a, b = map(int, input().split())
row_a = max(1, math.ceil((a - 1) / 50) * 2)
row_b = max(1, math.ceil((b - 1) / 50) * 2)

print("{} {}".format((row_a + row_b), 100))

rest = a - 1
for i in range(row_a):
  temp = ""
  if i % 2 == 0:
    for j in range(50):
      if rest != 0:
        temp += "
        rest -= 1
      else:
        temp += "
  else:
    for j in range(50):
      temp += "
  print(temp)
rest = b - 1
for i in range(row_b):
  temp = ""
  if i % 2 != 0:
    for j in range(50):
      if rest != 0:
        temp += ".
        rest -= 1
      else:
        temp += ".."
  else:
    for j in range(50):
      temp += ".."
  print(temp)

Solution (Python):
A, B = map(int, input().split())

grid = [['


def gen(X):
    cnt = 0
    for i in range(1, 50, 2):
        for j in range(1, 100, 2):
            if cnt < X:
                yield i, j
                cnt += 1


for i, j in gen(A - 1):
    grid[i][j] = '.'
for i, j in gen(B - 1):
    grid[i + 50][j] = '

print(100, 100)
for row in grid:
    print(''.join(row))

Solution (Python):
a,b=map(int,input().split())

grid=[["


print(100,100)
a-=1  
for i in range(1,49):
    for j in range(1,99):
        if all([ grid[i+x][j+y]=="
            if a==0:
                break
            grid[i][j]="."
            a-=1

            
    if a==0:
        break
b-=1
for i in range(51,99):
    for j in range(1,99):
        if all([ grid[i+x][j+y]=="." for x,y in ((0,0),(0,1),(1,0),(-1,0),(0,-1),(1,1),(-1,1),(1,-1),(-1,-1))]):
            if b==0:
                break
            grid[i][j]="
            b-=1

            
    if b==0:
        break
for i in grid:
    print("".join(i))

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
a,b=map(int,input().split())
grid=[[0]*100 for i in range(100)]
grid[0]
for i in range(50):
    for j in range(100):
        grid[50+i][j]=1
h,i,j=99,0,0

while(i<a-1):
    grid[h][j]=0
    i+=1
    j+=2
    if j==100:
        j=0
        h-=2

h,i,j=0,0,0
while(i<b-1):
    grid[h][j]=1
    i+=1
    j+=2
    if j==100:
        j=0
        h+=2
print("100 100")
for i in range(100):
    tmp=""
    for j in range(100):
        if grid[i][j]==1:
            tmp+="
        else:
            tmp+="."
    print(tmp)

Solution (Python):
a,b=map(int,input().split())

res = []
if a>10:
    while a>50:
        res.append("
        res.append("
        a -= 50
    while a>10:
        res.append("
        res.append("
        a -= 10
    b -= 1
res.append("."*100)
while b > 50:
    res.append("
    res.append("."*100)
    b-= 50
while b > 10:
    res.append("
    res.append("."*100)
    b-= 10

if b>a:
    sa = b-a
    res.append("
    res.append("."*100)
    for _ in range(a):
        res.append("
        res.append("."*100)
    res.pop()
elif a>b:
    if b == 0:
        res.pop()
    res.append("
    sa = a-b
    res.append(".
    res.append("
    b -= 1
    for _ in range(b):
        res.append("."*100)
        res.append("

else:
    for _ in range(a):
        res.append("
        res.append("."*100)
    res.pop()

print(str(len(res))+" 100")
print("\n".join(res))

Solution (Python):
A, B = map(int, input().split())

g = [["

for i in range(A-1):
    x, y = (i%50)*2, (i//50)*2
    g[y][x] = "."
for i in range(B-1):
    x, y = (i%50)*2, 51+(i//50)*2
    g[y][x] = "

print(100, 100)
for g_i in g:
    print("".join(g_i))

Solution (Python):
a,b=map(int,input().split())
ans=[["
for i in range(50):
    ans.append(["."]*100)

for i in range(0,49,2):
    for j in range(0,100,2):
        if a==1:
            break
        ans[i][j]="."
        a-=1
    if a==1:
        break

for i in range(51,100,2):
    for j in range(0,100,2):
        if b==1:
            break
        ans[i][j]="
        b-=1
    if b==1:
        break
print(100,100)
for i in ans:
    print("".join(i))

Solution (Python):
a,b=map(int,input().split())
ans=[]
for i in range(100):
    if i<50:
        ans.append(["
    else:
        ans.append(["."]*100)

for i in range(0,49,2):
    for j in range(0,100,2):
        if a==1:
            break
        ans[i][j]="."
        a-=1
    if a==1:
        break

for i in range(51,100,2):
    for j in range(0,100,2):
        if b==1:
            break
        ans[i][j]="
        b-=1
    if b==1:
        break
print(100,100)
for i in ans:
    print("".join(i))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    t = [["
    w, b = map(int, input().split())
    w, b = w - 1, b - 1
    br = False
    for i in range(0, 50, 2):
        for j in range(0, 100, 2):
            if w == 0:
                br = True
                break
            t[i][j] = "."
            w -= 1
        if br: break
    br = False
    for i in range(51, 100, 2):
        for j in range(0, 100, 2):
            if b == 0:
                br = True
                break
            t[i][j] = "
            b -= 1
        if br: break
    print(100, 100)
    for x in t:
        print(*x, sep="")

main()

Solution (Python):

A,B = map(int,input().split())

lisA = [["."] * 100 for i in range(50)]
lisB = [["

nx = 0
ny = 0

for i in range(B-1):

    lisA[ny][nx] = "

    nx += 2

    if nx >= 100:
        nx = 0
        ny += 2

nx = 0
ny = 1
for i in range(A-1):

    lisB[ny][nx] = "."

    nx += 2

    if nx >= 100:
        nx = 0
        ny += 2

print (100,100)

for i in lisA:
    print ("".join(i))

for i in lisB:
    print ("".join(i))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B = MAP()

masu = []
for i in range(50):  
	masu.append(["
for i in range(50):  
	masu.append(["."]*100)

row = 0
column = 0
for i in range(A-1):
	masu[row][column] = "."
	column += 2
	if column >= 100:
		column = 0
		row += 2

row = -1
column = 0
for i in range(B-1):
	masu[row][column] = "
	column += 2
	if column >= 100:
		column = 0
		row -= 2

print(100, 100)
for i in range(100):
	print(*masu[i], sep="")

Solution (Python):
A, B = map(int, input().split())

g = [["

for i in range(A-1):
    x, y = (i%50)*2, (i//50)*2
    g[y][x] = "."
for i in range(B-1):
    x, y = (i%50)*2, 51+(i//50)*2
    g[y][x] = "

print(100, 100)
for g_i in g:
    print("".join(g_i))

Solution (Python):
A, B = map(int, input().split())
A -= 1
B -= 1

ret = [[i // 50] * 100 for i in range(100)]

x, y = 0, 0
while A :
    ret[y][x] = 1
    A -= 1
    x += 2
    if x >= 100 :
        x = 0
        y += 2
        
x, y = 0, 51
while B :
    ret[y][x] = 0
    B -= 1
    x += 2
    if x >= 100 :
        x = 0
        y += 2
        
print(100, 100)
for y in range(100) :
    print(''.join(['

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))



A,B = II()

if A>=B:
    s = [['
    B -= 1
    for i in range(1,100,4):
        for j in range(1,80,4):
            if B == 0:
                break
            s[i-1][j-1] = s[i-1][j] = s[i-1][j+1] = '.'
            s[i][j-1] = s[i][j+1] = '.'
            s[i+1][j-1] = s[i+1][j] = s[i+1][j+1] = '.'
            B -= 1
            A -= 1
        else:
            continue
        break
    for j in range(81,100,2):
        for i in range(0,100,2):
            if A==0:
                break
            s[i][j] = '.'
            A -= 1
        else:
            continue
        break

else:
    s = [['.']*100 for _ in range(100)]
    A -= 1
    for i in range(1,100,4):
        for j in range(1,80,4):
            if A == 0:
                break
            s[i-1][j-1] = s[i-1][j] = s[i-1][j+1] = '
            s[i][j-1] = s[i][j+1] = '
            s[i+1][j-1] = s[i+1][j] = s[i+1][j+1] = '
            A -= 1
            B -= 1
        else:
            continue
        break
    for j in range(81,100,2):
        for i in range(0,100,2):
            if B==0:
                break
            s[i][j] = '
            B -= 1
        else:
            continue
        break

print(100,100)
for s0 in s:
    print(*s0, sep='')

Solution (Python):
A, B = map(int,input().split())
A -= 1
B -= 1

grid = [list("

def fill_white(A):
    for i in range(1,50,2):
        for j in range(0,100,2):
            if A > 0:
                grid[i][j] = "."
                A -= 1
            else:
                return

def fill_black(B):
    for i in range(51,100,2):
        for j in range(0,100,2):
            if B > 0:
                grid[i][j] = "
                B -= 1
            else:
                return

fill_white(A)
fill_black(B)

print(100,100)

for line in grid:
    print("".join(line))

Solution (Python):
W,B = map(int, input().strip().split(' '))

ans = []
width = 100


if B == 1:
  ans.append('.'*width)
b = 1
while b < B:
  line = ['.']*width
  for i in range(0,width,2):
    if b >= B: break
    b += 1
    line[i] = '
  ans.append(line)
  ans.append('.'*width)


if W == 1:
  ans.append('
w = 1
while w < W:
  line = ['
  for i in range(0,width,2):
    if w >= W: break
    w += 1
    line[i] = '.'
  ans.append('
  ans.append(line)

print(len(ans), width)
for b in ans:
  print(*b, sep='')

Solution (Python):
A, B = map(int, input().split())

print(100, 100)

a = A-1
b = B-1

a,b = b,a

qa = a//50
qb = b//50
ra = a%50
rb = b%50
for i in range(50):
  if i%2 == 1:
    print("."*100)
  else:
    if qa == 0:
      if ra == 0:
        print("."*100)
      else:
        print("
        ra = 0
    else:
      print("
      qa -= 1
for i in range(50):
  if i%2 == 0:
    print("
  else:
    if qb == 0:
      if rb == 0:
        print("
      else:
        print(".
        rb = 0
    else:
      print(".
      qb -= 1

Solution (Python):
A, B = [int(_) for _ in input().split()]


def make(o, x, p):
    
    
    lines = p // 50
    r = p % 50
    return [o * 100] + [(x + o) * 50, o * 100] * lines + [(x + o) * r +
                                                          (o + o) *
                                                          (50 - r), o * 100]


ans = make('.', '
print(len(ans), 100)
for s in ans:
    print(s)

Solution (Python):
A,B = map(int,input().split())

H = W = 100
Ans = ["
count = 0
i = 0
j = 0
while count < A-1:
    count += 1
    Ans[i] = Ans[i][:j] + "." + Ans[i][j+1:]
    if j == 98:
        i += 2
        j = 0
    else:
        j += 2

count = 0
i = 0
j = 0
while count < B-1:
    count += 1
    Ans[99-i] = Ans[99-i][:j] + "
    if j == 98:
        i += 2
        j = 0
    else:
        j += 2
print(*[H,W])
for i in range(H):
    print(Ans[i])

Solution (Python):
a, b = map(int, input().split())

c1 = '
c2 = '.' if a < b else '

ans = []

WIDTH = 50
d = abs(a - b)
d1 = d % WIDTH
d2 = d // WIDTH
e = min(a, b) - 1
f = e % WIDTH
e = e // WIDTH
ans.append(c1*WIDTH*2)
ans.append((c2+c1)*f + c1 * 2 * (WIDTH - f))
ans.append(c1*WIDTH*2)
for i in range(e+1):
    if i % 2 == 0:
        ans.append((c1+c2)*WIDTH)
    else:
        ans.append((c2+c1)*WIDTH)
ans.append(c2*WIDTH*2)
ans.append((c1+c2)*f + c2 * 2 * (WIDTH-f))
ans.append(c2*WIDTH*2)

if d1 != 0:
    ans.append((c2+c1)*d1 + c2 * 2 * (WIDTH - d1))
    ans.append(c2*WIDTH*2)
for i in range(d2):
    ans.append((c2+c1)*WIDTH)
    ans.append(c2*WIDTH*2)


print(len(ans), WIDTH*2)
for ansi in ans:
    print(ansi)

Solution (Python):
from itertools import product

A, B = map(int, input().split())
A -= 1
B -= 1

G = [["
for i, j in product(range(0, 50, 2), repeat=2):
    if A <= 0:
        break
    G[i][j] = "."
    A -= 1

H = [["." for _ in range(100)] for _ in range(50)]
for i, j in product(range(1, 51, 2), repeat=2):
    if B <= 0:
        break
    H[i][j] = "
    B -= 1

print(100, 100)
for g in G:
    print("".join(g))

for h in H:
    print("".join(h))

Solution (Python):
a,b=map(int,input().split())
h,w=100,100
la=[]
for i in range(a-1):
    if i==0:
        x,y=0,-2
    else:
        x,y=la[-1]
    y+=2
    if y>=w:
        x+=2
        y=0
    la.append((x,y))
la=set(la)
lb=[]
for i in range(b-1):
    if i==0:
        x,y=51,-2
    else:
        x,y=lb[-1]
    y+=2
    if y>=w:
        x+=2
        y=0
    lb.append((x,y))
lb=set(lb)

ans=[]
print(h,w)
for i in range(100):
    tmp=""
    for j in range(100):
        if (i,j) in la:
            tmp+="."
        elif (i,j) in lb:
            tmp+="
        elif i<50:
            tmp+="
        else:
            tmp+="."
    print(tmp)

Solution (Python):
a,b=map(int,input().split())
a-=1
b-=1
l=[['
for i in range(0,a//50*2,2):
    l[i]=['.','
for i in range(0,a%50*2,2):
    l[a//50*2][i]='.'
for i in range(21,21+b//50*2,2):
    l[i]=['
for i in range(0,b%50*2,2):
    l[21+b//50*2][i]='
print(40,100)
for x in l:
    print(''.join(x))

Solution (Python):

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007


def A():
    a = IR(2)
    b = IR(2)
    print(min(a)+min(b))


def B():
    n = I()
    d, x = LI()
    a = IR(n)
    ans = x
    for i in a:
        k = 0
        while k * i + 1 <= d:
            ans += 1
            k += 1
    print(ans)



def C():
    n = I()
    a = LI()
    a.insert(0, 0)
    a.append(0)
    ans = 0
    for i in range(1, n + 2):
        ans += abs(a[i] - a[i - 1])
    
    for k in range(1, n + 1):
        if a[k - 1] < a[k]:
            if a[k] > a[k + 1]:
                print(ans - 2 * min(abs(a[k] - a[k - 1]), abs(a[k] - a[k + 1])))
            else:
                print(ans)
        if a[k - 1] > a[k]:
            if a[k] < a[k + 1]:
                print(ans - 2 * min(abs(a[k] - a[k - 1]), abs(a[k] - a[k + 1])))
            else:
                print(ans)
        if a[k - 1] == a[k]:
            print(ans)



def D():
    a, b = LI()
    print(100, 100)
    ans = [["
    for i in range(a - 1):
        ans[(i // 50) * 2][i % 50 * 2] = "."
    for i in range(b - 1):
        ans[-((i // 50) * 2) - 1][i % 50 * 2] = "
    for ansi in ans:
        print("".join(ansi))
    return

if __name__ == '__main__':
    D()