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())
ans = [['.']*50 + ['
cnt = 1
for i in range(0, 100, 2):
    for j in range(0, 49, 2):
        if cnt == B:
            break
        ans[i][j] = '
        cnt += 1
    if cnt == B:
        break
cnt = 1
for i in range(0, 100, 2):
    for j in range(51, 100, 2):
        if cnt == A:
            break
        ans[i][j] = '.'
        cnt += 1
    if cnt == A:
        break

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

Solution (Python):
B, A = map(int, input().split())
K = []
for i in range(50):
    K.append(["."]*100)
for j in range(50):
    K.append(["
a = 1
b = 1
t = 0
while(True):
    if A == a:
        break
    for i in range(0, 100, 4):
        K[t][i] = "
        a += 1
        if A == a:
            break
    if A == a:
        break
    t += 1
    for i in range(2, 100, 4):
        K[t][i] = "
        a += 1
        if A == a:
            break
    t += 1

t = 51
while(True):
    if B == b:
        break
    for i in range(0, 100, 4):
        K[t][i] = "."
        b += 1
        if B == b:
            break
    if B == b:
        break
    t += 1
    for i in range(2, 100, 4):
        K[t][i] = "."
        b += 1
        if B == b:
            break
    t += 1
print(100, 100)
for i in range(100):
    for j in K[i]:
        print(j, end="")
    print()

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

grid = [["." for _ in range(100)] for _ in range(100)]


for r in range(50):
    for c in range(100):
        grid[r][c] = "


cnt_w = 1
for r in range(0, 49, 2):
    for c in range(100):
        if cnt_w < A:
            if c % 2 == 0:
                grid[r][c] = "."
                cnt_w += 1
        else:
            break


cnt_b = 1
for r in range(51, 100, 2):
    for c in range(100):
        if cnt_b < B:
            if c % 2 == 0:
                grid[r][c] = "
                cnt_b += 1
        else:
            break

print(100, 100)
for r in range(100):
    print("".join(grid[r]))

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

grid = [["." for _ in range(100)] for _ in range(100)]


for r in range(50):
    for c in range(100):
        grid[r][c] = "


cnt_w = 1
for r in range(0, 49, 2):
    for c in range(100):
        if cnt_w < A:
            if c % 2 == 0:
                grid[r][c] = "."
                cnt_w += 1


cnt_b = 1
for r in range(51, 100, 2):
    for c in range(100):
        if cnt_b < B:
            if c % 2 == 0:
                grid[r][c] = "
                cnt_b += 1

print(100, 100)
for r in range(100):
    print("".join(grid[r]))

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

grid = [["." for _ in range(100)] for _ in range(100)]


for r in range(50):
    for c in range(100):
        grid[r][c] = "


cnt_w = 1
for r in range(0, 49, 2):
    for c in range(100):
        if cnt_w < A:
            if r % 2 == 0 and c % 2 == 0:
                grid[r][c] = "."
                cnt_w += 1
            elif r % 2 == 1 and c % 2 == 1:
                grid[r][c] = "."
                cnt_w += 1


cnt_b = 1
for r in range(51, 100, 2):
    for c in range(100):
        if cnt_b < B:
            if r % 2 == 0 and c % 2 == 0:
                grid[r][c] = "
                cnt_b += 1
            elif r % 2 == 1 and c % 2 == 1:
                grid[r][c] = "
                cnt_b += 1

print(100, 100)
for r in range(100):
    print("".join(grid[r]))

Solution (Python):

import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

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

mat = [["."] * 100 for _ in range(50)] + [["









black_count = 1
white_count = 1

for i in range(0, 50, 2):
    if black_count == B:
        break
    for j in range(0, 100, 2):
        if black_count == B:
            break
        mat[i][j] = "
        black_count += 1
for i in range(1, 50, 2):
    if white_count == A:
        break
    for j in range(0, 100, 2):
        if white_count == A:
            break
        mat[-i][j] = "."
        white_count += 1

print(100, 100)
for mati in mat:
    print("".join(mati))

Solution (Python):
AB = tuple(map(int, input().split()))
WB = ".

grid = [[[WB[-1-i]]*100 for _ in range(50)] for i in range(2)]

for i in range(2):
  H, W = divmod(AB[i]-1, 50)
  for h in range(H):
    for j in range(50):
      grid[i][2*h+i][2*j] = WB[i]
  for w in range(W):
    grid[i][2*H+i][2*w] = WB[i]

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

Solution (Python):

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

grid = [["
grid += [["."]*100 for _ in range(50)]

ha, wa = divmod(A-1, 50)
for h in range(ha):
  for j in range(50):
    grid[2*h][2*j] = "."
for w in range(wa):
  grid[2*ha][2*w] = "."

hb, wb = divmod(B-1, 50)
for h in range(hb):
  for j in range(50):
    grid[51+2*h][2*j] = "
for w in range(wb):
  grid[51+2*hb][2*w] = "

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

Solution (Python):


import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A,B = map(int,readline().split())
grid = []
for _ in range(50):
    grid.append(['.']*100)
for _ in range(50):
    grid.append(['
A -= 1
B -= 1

cnt = 0
f = 0
for i in range(1,50,2):
    for j in range(1,99,2):
        if cnt == B:
            f = 1
            break
        cnt += 1
        grid[i][j] = '
    if f == 1:
        break
cnt = 0
f = 0
for i in range(51,100,2):
    for j in range(1,99,2):
        if cnt == A:
            f = 1
            break
        cnt += 1
        grid[i][j] = '.'
    if f == 1:
        break
print(100,100)
for row in grid:
    print(''.join(a for a in row))

Solution (Python):
def main():
    a, b = map(int, input().split())
    
    h = ((max(a, b) - 1) // 16 + 1) * 3
    w = 96 

    print(h, w)

    ans = []
    line1 = ['.', '.', '.', '
    line2 = ['

    for i in range(h//3):
        if i % 2 == 0:
            ans.append(line1.copy())
            ans.append(line1.copy())
            ans.append(line1.copy())
        else:
            ans.append(line2.copy())
            ans.append(line2.copy())
            ans.append(line2.copy())

    if a <= b:
        a, b = b, a
        flag = True
    else:
        flag = False

    if a % 16 > 0:
        for i in range(6 * (16 - a % 16) + 3):
            ans[-1][i] = '.'

    if h == 3:
        for i in range(6 * (16 - b) + 3):
            ans[0][i] = '
    else:
        num = h//3 * 16 - b
        for i in range(num // 16):
            if ans[2 + 3*i][0] == '.':
                for j in range(16):
                    ans[2 + 3*i][2 + 6*j] = '
            else:
                for j in range(16):
                    ans[2 + 3*i][3 + 6*j] = '

        if ans[-3][0] == '.':
            for i in range(num % 16):
                ans[-3][6 + 6*i] = '
        else:
            for i in range(num % 16):
                ans[-3][5 + 6*i] = '

    if flag:
        for i in range(h):
            for j in range(w):
                if ans[i][j] == '.':
                    ans[i][j] = '
                else:
                    ans[i][j] = '.'

    for i in ans:
        print(''.join(i))

main()

Solution (Python):
def main():
    a, b = map(int, input().split())
    
    h = ((max(a, b) - 1) // 16 + 1) * 3
    w = 96 

    print(h, w)

    ans = []
    line1 = ['.', '.', '.', '
    line2 = ['

    for i in range(h//3):
        if i % 2 == 0:
            ans.append(line1.copy())
            ans.append(line1.copy())
            ans.append(line1.copy())
        else:
            ans.append(line2.copy())
            ans.append(line2.copy())
            ans.append(line2.copy())

    if a <= b:
        a, b = b, a
        flag = True
    else:
        flag = False

    if a % 16 > 0:
        for i in range(6 * (16 - a % 16) + 3):
            ans[-1][i] = '.'

    if h == 3:
        for i in range(6 * (16 - b) + 3):
            ans[0][i] = '
    else:
        num = h//3 * 16 - b
        for i in range(num // 16):
            if ans[2 + 3*i][0] == '.':
                for j in range(16):
                    ans[2 + 3*i][2 + 6*j] = '
            else:
                for j in range(16):
                    ans[2 + 3*i][3 + 6*j] = '

        if ans[-3][0] == '.':
            for i in range(num % 16):
                ans[-3][6 + 6*i] = '
        else:
            for i in range(num % 16):
                ans[-3][5 + 6*i] = '

    if flag:
        for i in range(h):
            for j in range(w):
                if ans[i][j] == '.':
                    ans[i][j] = '
                else:
                    ans[i][j] = '.'

    for i in ans:
        print(''.join(i))

main()

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

for n in range(50):
  print(50*"."+50*"
  a = min(24,A)
  b = min(24,B)
  print(b*".
  A-=a
  B-=b

Solution (Python):


a, b = list(map(int, input().split()))


a -= 1
b -= 1
wide = 100

ans1 = [["

ans2 = [["."]*wide for i in range(wide//2)]

index_x = 0
index_y = 0
while(a > 0):
    ans1[index_y][index_x] = "."
    index_x += 2
    if index_x == wide:
        index_x = 0
        index_y += 2
    a -= 1


index_x = 0
index_y = 1
a = b
while(a > 0):
    ans2[index_y][index_x] = "
    index_x += 2
    if index_x == wide:
        index_x = 0
        index_y += 2
    a -= 1

print(100, 100)
for i in ans1+ans2:
    print("".join(i))

Solution (Python):
A, B = map(int, input().split())
import numpy as np
Grid = np.concatenate((np.zeros((50, 100), dtype='int64'),np.ones((50,100), dtype='int64')),axis=0)

for b in range(B-1):
    y, x = divmod(b, 50)
    Grid[2*y,2*x] = 1

for a in range(A-1):
    y, x = divmod(a, 50)
    Grid[99-2*y,2*x] = 0

print(*(100, 100))
for j in range(100):
    print(''.join(['.' if Grid[j,i]==0 else '

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

for i in range((a - 1) // 50):
    for j in range(50):
        ans[51 + i * 2][2 * j] = "."
for i in range((a - 1) % 50):
    ans[99][2 * i] = "."
for i in range((b - 1) // 50):
    for j in range(50):
        ans[i * 2][2 * j] = "
for i in range((b - 1) % 50):
    ans[48][2 * i] = "

print(100, 100)
for i in range(100):
    print("".join(ans[i]))

Solution (Python):
A, B = map(int, input().split())
A -= 1
B -= 1
G = []
for h in range(50):
    G.append(["
for h in range(50):
    G.append(["."]*100)
i, j = 0, 0
for _ in range(A):
    G[i][j] = "."
    j += 2
    if j>=100:
        i += 2
        j = 0
i, j = 99, 0
for _ in range(B):
    G[i][j] = "
    j += 2
    if j>=100:
        i -= 2
        j = 0
print(100,100)
for i in range(100):
    print("".join(G[i]))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b = map(int, input().split())

    res = [["."] * 100 for _ in range(100)]
    for h in range(50, 100):
        for w in range(100):
            res[h][w] = "

    for h in range(0, 100, 2):
        for w in range(0, 100, 2):
            if b == 1:
                break
            res[h][w] = "
            b -= 1
        else:
            continue
        break

    for h in reversed(range(0, 100, 2)):
        for w in range(0, 100, 2):
            if a == 1:
                break
            res[h][w] = "."
            a -= 1
        else:
            continue
        break

    print(100, 100)
    for i in res:
        print("".join(i))


if __name__ == '__main__':
    resolve()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def pr(g):
    string = ''
    for row in g:
        string += ''.join([str(x) for x in row])
        string += '\n'
    print(string)

A, B = LI()
def main():
    rev = False
    global A, B
    if A < B:
        A, B = B, A
        rev = True
    h = 100
    w = 100
    g = [[0 for _ in range(w)] for __ in range(h)]
    cnt = 0

    def fill(i=None, j=None):
        global A, B
        filled = False
        if i:
            st = i
        else:
            st = 0
        if j:
            stj = j
        else:
            stj = 0
        
        for i in range(st+1, h-1):
            if filled:
                break
            for j in range(w-1):
                if A == 0:
                    filled = True
                    l_i, l_j = i, j
                    break
                if i % 2 == 1 and j % 2 == 1:
                    g[i][j] = 1
                    A -= 1
        return l_i, l_j

    last_i, last_j = fill()

    def fill_left_up(i, j):
        cp_i = i
        if i-1 >= 0:
            while g[i-1][j] == 0:
                g[i-1][j] = 1
                i -= 1
                if i-1 < 0:
                    break
        i = cp_i
        if j-1 >= 0:
            while g[i][j-1] == 0:
                g[i][j-1] = 1
                j -= 1
                if j-1 < 0:
                    break

    first = True
    B -= 1
    for i in range(h-1):
        for j in range(w-1):
            if g[i][j] == 1 and B > 0:
                fill_left_up(i, j)
                B -= 1
                if first:
                    first = False
                else:
                    A += 1

    fill(last_i, last_j)

    A_symbol = '.'
    B_symbol = '
    if rev:
        A_symbol, B_symbol = B_symbol, A_symbol
    print(h, w)
    for i in range(h):
        for j in range(w):
            if g[i][j] == 1:
                print(A_symbol, end='')
            else:
                print(B_symbol, end='')
        print()



main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

    S = [['

    for n in range(A - 1):
        q, r = divmod(n, 50)
        S[2 * q + 1][2 * r] = '.'

    for n in range(B - 1):
        q, r = divmod(n, 50)
        S[2 * q + 51][2 * r] = '

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

    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

    S = [['

    for n in range(A - 1):
        q, r = divmod(n, 50)
        i = 3 * q + 1 + (r % 2 == 1)
        j = r
        S[i][j] = '.'

    for n in range(B - 1):
        q, r = divmod(n, 50)
        i = 3 * q + 51 + (r % 2 == 1)
        j = r
        S[i][j] = '

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

    return


if __name__ == '__main__':
    main()

Solution (Python):
k=50
a,b=map(int,input().split())
a-=1;b-=1
ans=[["
for i in range(k):
	for j in range(2*k):
		ans[i][j]="."
for i in range(k-1):
	if b>0:
		for j in range(i%2*2,2*k,4):
			if b>0:
				ans[i][j]="
				b-=1
			else:
				break
for i in range(k+1,2*k):
	if a>0:
		for j in range(i%2*2,2*k,4):
			if a>0:
				ans[i][j]="."
				a-=1
			else:
				break
print(2*k,2*k)
for i in range(2*k):
	print("".join(ans[i]))

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

h, w = 100, 100
board = [["."] * 100 for i in range(100)]

for i in range(50):
  for j in range(100):
    board[i][j] = "


l, r = 0, 0
while A > 1:
  A -= 1
  board[l][r] = "."
  r += 2
  if r == 100:
    l += 2
    r = 0

l, r = 99, 99 
while B > 1:
  B -= 1
  board[l][r] = "
  r -= 2
  if r == 1:
    l -= 2
    r = 99
print(h,w)
for i in range(100):
  for j in range(100):
    print(board[i][j], end = "")
  print("")

Solution (Python):
W, B = map(int, input().split())
h = 100
w = 100
X = [['

for i in range(0, h, 2):
    for j in range(0, w, 2):
        if W == 1:
            break
        X[i][j] = '.'
        W -= 1

for i in range(h//2 + 1, h, 2):
    for j in range(0, w, 2):
        if B == 1:
            break
        X[i][j] = '
        B -= 1
print(h, w)
for i in range(h):
    print("".join(X[i]))

Solution (Python):
A,B=map(int,input().split())
ans=[[] for _ in range(100)]
for i in range(100):
  for j in range(100):
    if i<50:
      ans[i].append(".")
    else:
      ans[i].append("
A-=1
B-=1
for i in range(0,50,2):
  for j in range(0,100,2):
    if B>0:
      ans[i][j]="
      B-=1
for i in range(51,100,2):
  for j in range(0,100,2):
    if A>0:
      ans[i][j]="."
      A-=1
print(100,100)
for i in range(100):
  print("".join(ans[i]))

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


A,B = A-1,B-1
ANS = []
def calc(X):
  if X>49:
    X -= 49
    wk = 49
  else:
    wk = X
    X = 0
  return X,wk

while A > 0:
  ANS.append("
  A,wk = calc(A)
  ANS.append("
  A,wk = calc(A)
  ANS.append("
ANS.append("
while B > 0:
  ANS.append("."*100)
  B,wk = calc(B)
  ANS.append("." + ".
  B,wk = calc(B)
  ANS.append("." + "
ANS.append("."*100)

print(len(ANS), 100)
for a in ANS:
  print("".join(a))
  
"""
こう言うブロックを繰り返すと、３−４行で98分離成分が稼げる
100/2= 50行あれば、A、BのMAX500は稼げる。構築する




"""

Solution (Python):


A, B = map(int, input().split())
A -= 1
B -= 1
grid = [['
grid.extend([['.'] * 100 for _ in range(50)])

for i in range(1, A+1):
    tmp_q = (i * 2) - 1
    q = tmp_q % 100
    tmp_p = tmp_q // 100 + 1
    p = (tmp_p * 2) - 1
    grid[p][q] = '.'

for j in range(1, B+1):
    tmp_q = (j * 2) - 1
    q = tmp_q % 100
    tmp_p = tmp_q // 100 + 1
    p = (tmp_p * 2) - 1
    p += 50
    grid[p][q] = '

print('100 100')

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

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

ans = [["." for j in range(100)] for i in range(100)]

for i in range(50):
    for j in range(100):
        ans[i][j]="


for i in range(A-1):
    ans[2*(i//50)][2*(i%50)]="."

for i in range(B-1):
    ans[51+2*(i//50)][2*(i%50)]="

print(100,100)
for i in range(100):
    print("".join(ans[i]))

Solution (Python):
a, b = map(int, input().split())
g = [['.']*100 for _ in range(100)]
for j in range(100):
    for i in range(50,100):
        g[i][j] = '


b_cnt = 1
i = 0
j = 0
while b_cnt < b:
    g[i][j] = '
    j += 2
    if j >= 100:
        i += 2
        j = 0
    b_cnt += 1
a_cnt = 1
i = 99
j = 0
while a_cnt < a:
    g[i][j] = '.'
    j += 2
    if j >= 100:
        i -= 2
        j = 0
    a_cnt += 1
print("100 100")
for i in range(100):
    print("".join(g[i]))

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

A,B = MI()

q1,r1 = (B-1)//50,(B-1)%50
q1 += 1
q2,r2 = (A-1)//50,(A-1)%50
q2 += 1

if B > 1 and A > 1:
    print(2*(q1+q2),100)
elif (B == 1 and A > 1) or (B > 1 and A == 1):
    print(2*(q1+q2)-1,100)
else:
    print(2,100)

if B > 1:
    for i in range(2 * q1):
        if i % 2 == 1:
            print(''.join(['.'] * 100))
        elif i != 2 * q1 - 2:
            print(''.join(['.', '
        else:
            print(''.join(['.', '
else:
    print(''.join(['.']*100))


if A > 1:
    for i in range(2 * q2):
        if i % 2 == 0:
            print(''.join(['
        elif i != 2 * q2 - 1:
            print(''.join(['
        else:
            print(''.join(['
else:
    print(''.join(['

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

s=[['.' if i<50 else '

a-=1
b-=1

for i in range(1,50,2):
    for j in range(0,100,2):
        if b>0:
            s[i][j]='
            b-=1
        if a>0:
            s[i+50][j]='.'
            a-=1
print('100 100')
for i in range(100):
    print(''.join(s[i]))

Solution (Python):
a,b=map(int,input().split())
print(100,100)
a-=1
b-=1

for i in range(25):
    for q in range(50):
        if b>0:
            print("
            b-=1
        else:
            print(".",end="")
        print(".",end="")
    print()
    print("."*100)
              
for i in range(25):
    print("
    for q in range(50):
        if a>0:
            print(".",end="")
            a-=1
        else:
            print("
        print("
    print()

Solution (Python):

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

H,W = 100,100
S = [[0]*H for _ in range(W)]
f = True
if A>B:
    A,B = B,A
    f = False
def change(r,c,state):
    for i in range(r,r+3):
        for j in range(c,c+3):
            S[i][j] = 1
    
    if state==0:
        S[r+1][c+1] = 0    
        return
    elif state==1:
        S[r+1][c+1] = 0
        for i in range(3):
            S[r+3][c+i] = 1
            S[r+i][c+3] = 1
        S[r+3][c+3] = 1
        if c+4==W:
            for i in range(4):
                S[r+i][c+3] = 0
            
        return
    elif state==2:     
        return
    


r,c = 0,0
white = 1
black = 0
while white!=A or black!=B:
    if white<A and black<B-1:
        change(r,c,0)
        white += 1
        black += 1
        
    elif white<A:
        change(r,c,1)
        white += 1
        
    elif black<B:
        change(r,c,2)
        black += 1
        
    else:
        break
    if c+4==W:
        c = 0
        r += 4
    else:
        c += 4

if f:
    T = [['.']*W for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if S[i][j]==1:
                T[i][j]='
else:
    T = [['
    for i in range(H):
        for j in range(W):
            if S[i][j]==1:
                T[i][j]='.'
print(H,W)
for t in T:
    print(''.join(t))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    """
    解説聞いたらそりゃそうなんだが、どうやったらスラスラ思いつくんだ。。。
    """
    ans1 = [['.'] * 100 for _ in range(50)]
    for i in range(b // 49):
        for j in range(49):
            ans1[i * 2 + 1][j * 2 + 1] = '
    for j in range(b % 49):
        ans1[b // 49 * 2 + 1][j * 2 + 1] = '

    ans2 = [['
    for i in range(a // 49):
        for j in range(49):
            ans2[i * 2 + 1][j * 2 + 1] = '.'
    for j in range(a % 49):
        ans2[a // 49 * 2 + 1][j * 2 + 1] = '.'

    ans = ans1 + ans2
    print(100, 100)
    for i in range(100):
        print("".join(ans[i]))


if __name__ == "__main__":
    main()

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

ans = [['.']*100 for _ in range(50)] + [['

if b != 1:
    B = 0
    for i in range(49):
        for j in range(100):
            flag = True
            for di, dj in (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1):
                ni, nj = i+di, j+dj
                if 0 <= ni < 50 and 0 <= nj < 100:
                    if ans[ni][nj] == '
                        flag = False
                        break
            if flag:
                ans[i][j] = '
                B += 1
            if B == b-1:
                break
        else:
            continue
        break

if a != 1:
    A = 0
    for i in range(51, 100):
        for j in range(100):
            flag = True
            for di, dj in (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1):
                ni, nj = i+di, j+dj
                if 50 <= ni < 100 and 0 <= nj < 100:
                    if ans[ni][nj] == '.':
                        flag = False
                        break
            if flag:
                ans[i][j] = '.'
                A += 1
            if A == a-1:
                break
        else:
            continue
        break

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

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

ans = [['.']*100 for _ in range(50)] + [['

if b != 1:
    B = 0
    for i in range(49):
        for j in range(100):
            flag = True
            for di, dj in (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1):
                ni, nj = i+di, j+dj
                if 0 <= ni < 50 and 0 <= nj < 100:
                    if ans[ni][nj] == '
                        flag = False
                        break
            if flag:
                ans[i][j] = '
                B += 1
            if B == b-1:
                break
        else:
            continue
        break

if a != 1:
    A = 0
    for i in range(51, 100):
        for j in range(100):
            flag = True
            for di, dj in (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1):
                ni, nj = i+di, j+dj
                if 50 <= ni < 100 and 0 <= nj < 100:
                    if ans[ni][nj] == '.':
                        flag = False
                        break
            if flag:
                ans[i][j] = '.'
                A += 1
            if A == a-1:
                break
        else:
            continue
        break

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

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

a -= 1
b -= 1
print(100, 100)
for i in range(100):
  l = []
  for j in range(100):
    c = '
    if i % 2 and j % 2:
      if i < 50 and a:
        c = '.'
        a -= 1
      if i >= 50 and b:
        c = '
        b -= 1
    l.append(c)
  print(''.join(l))

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7






A, B = getNM()
A -= 1
B -= 1

maze = [['


for i in range(100):
    for j in range(50, 100):
        maze[i][j] = "."

for i in range((A + 25 - 1) // 25):
    for j in range(25):
        maze[2 * i][2 * j] = '.'
        if i == ((A + 25 - 1) // 25) - 1 and j == (A % 25) - 1:
            break

for i in range((B + 25 - 1) // 25):
    for j in range(25):
        maze[2 * i][2 * j + 51] = '
        if i == ((B + 25 - 1) // 25) - 1 and j == (B % 25) - 1:
            break

print(len(maze), len(maze[0]))
for i in maze:
    print(''.join(i))

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b=MI()
grid=[[0]*100 for i in range(100)]
for i in range(50):
    for j in range(100):
        grid[i+50][j]=1

hor=[2*i for i in range(50)]

ver=[2*i for i in range(25)]

count=0
print(100,end=" ")
print(100)
if b>1:
    for x in hor:
        for y in ver:
            grid[y][x]=1
            count+=1
            if count==b-1:
                break
        else:
            continue
        break

count=0
if a>1:
    for x in hor:
        for y in ver:
            grid[99-y][x]=0
            count+=1
            if count==a-1:
                break
        else:
            continue
        break
for i in range(100):
    for j in range(100):
        if grid[i][j]==1:
            print("
        else:
            print(".",end="")
    print()

Solution (Python):
A,B  =map(int,input().split())
K = 50
S = [['.']*(2*K) for _ in range(2*K)]
for i in range(K):
    for j in range(2*K):
        S[i][j] ='
i,j = 0,0
A-=1
B-=1
while A>0:
    S[i][j] ='.'
    if j +2 <2*K:
        j +=2
    else:
        i += 2
        j=0
    A-=1
i,j = 2*K-1,2*K-1
while B>0:
    S[i][j]='
    if j-2>0:
        j-=2
    else:
        i-=2
        j=2*K-1
    B-=1
print(str(2*K)+' '+str(2*K))
for s in S:
    print(''.join(s))