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):
"""

Wは100で固定する。
1行目でできるかぎり連結成分の数が多くなるようにする。


W=100で固定し、白黒格子上になるように列を組む。
白と黒どちらかが規定数をオーバーしたら次の行で調整を入れて数を減らす。
ここでは、白が規定数に達したと仮定しよう。
白色の数に調整を入れたら、次の行では
"""
A,B = map(int,input().split())
N = 100
n = N//2
grid = [["
for i in range(n,N):
    for j in range(N):
        grid[i][j] = "."

A -= 1
B -= 1

for i in range(0,A//n*2,2):
    for j in range(0,N,2):
        grid[i][j] = "."

for j in range(0,A%n*2,2):
    grid[A//n*2][j] = "."

grid = grid[::-1]
for i in range(0,B//n*2,2):
    for j in range(0,N,2):
        grid[i][j] = "

for j in range(0,B%n*2,2):
    grid[B//n*2][j] = "

print(" ".join([str(N),str(N)]))
for i in range(N):
    print("".join(grid[i]))

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

g = [['
for k in range(2):
    cnt = 0
    flag = False
    c = '.' if k == 0 else '
    for i in range(51*k, 50*(k+1), 2):
        for j in range(0, 100, 2):
            if cnt == ab[k]-1:
                flag = True
                break
            g[i][j] = c
            cnt += 1
        if flag:
            break
print(100, 100)
for i in g:
    print(''.join(i))

Solution (Python):
K = 33
L = K * 2
s = [['
t = [['.' for j in range(L)] for i in range(K)]

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

def color(s, j0, i1, c):
    j = j0
    k = j0 * 2
    for i in range(1, i1):
        if L <= k:
            j += 1
            k = (j & 1) << 1
        s[j][k] = c
        k += 4

color(s, 0, A, '.')
color(t, 1, B, '

print(L, L)
f = lambda s : print('\n'.join((map(lambda s : ''.join(s), s))))
f(s)
f(t)

Solution (Python):
def fill(X, c, start):
    for i in range(X):
        q, r = divmod(i, 49)
        i = q * 2 + start
        j = r * 2 + 1 if q % 2 else r * 2 + 2
        ans[i][j] = c


A, B = map(int, input().split())
H, W = 100, 100
ans = [list("
fill(A - 1, ".", 1)
fill(B - 1, "
print(H, W)
[print("".join(row)) for row in ans]

Solution (Python):
A,B = map(int,input().split())
MAX = 100
ans = []
for i in range(MAX): 
  if i < MAX//2:
    temp = ["."]*MAX
  else:
    temp = ["
  ans.append(temp)

A-=1;B-=1
h = 0; w = 0
for j in range(B): 
  ans[h][w] = "
  w += 2
  if w > MAX-1:
    h += 2
    w = 0


h = MAX//2+1; w = 0
for j in range(A):
  ans[h][w] = "."
  w += 2
  if w > MAX-1:
    h += 2
    w = 0
L = [MAX,MAX]
print(*L)
for i in range(MAX):
  output = "".join(ans[i])
  print(output)

Solution (Python):
import sys









MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    a, b = read_ints()
    print(100, 100)
    grid = [['
    for i in range(~-a):
        x, y = divmod(i, 49)
        grid[x * 2 + 1][y * 2 + 1] = '.'
    for i in range(~-b):
        x, y = divmod(i, 49)
        grid[x * 2 + 51][y * 2 + 1] = '
    print(*[''.join(g) for g in grid], sep='\n')

if __name__ == '__main__':
    Main()

Solution (Python):
a,b= map(int,input().split())
line=''.join(['.
dot=['.','
cl=[''.join(['.']*100),''.join(['
ba=[b-1,a-1]
ans=[]
y=ans.append
for c in [0,1]:
    y(cl[c])
    for i in range(ba[c]//50):
        y(line)
        y(cl[c])
    y(''.join(['.
    y(cl[c])
print(len(ans),100)
for l in ans:print(''.join(l))

Solution (Python):
a, b = map(int, input().split())
d = [["
for i in range(a - 1):
    d[(i // 50) * 4][(i % 50) * 2] = "."
for i in range(b - 1):
    d[99 - (i // 50) * 2][(i % 50) * 2] = "
print(100, 100)
for i in range(100):
    print(*d[i], sep="")

Solution (Python):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
a,b = ma()
wh= "."
bl = "
if a>b:
    a,b = b,a
    wh,bl=bl,wh
area = [[wh]*100 for i in range(100)]
def cycle(y,x,f=True):
    for i in range(y,y+3):
        for j in range(x,x+3):
            area[i][j]=bl
    if f:
        area[y+1][x+1] = wh
def solve():
    cnt=0
    iy = 0
    ix = 0
    while cnt<b:
        if cnt+1<a:
            cycle(iy,ix)
        else:
            cycle(iy,ix,f=False)
        ix+=4
        if ix>=95:
            ix = 0
            iy+=4
        cnt+=1

solve()
print(100,100)
for ar in area:
    print("".join(ar))

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

kuro = [["
siro = [["." for i in range(100)] for j in range(20)]

cou = 0
flag = False
for i in range(0,20,2):
    if flag:
        break
    for j in range(0,100,2):
        if cou >= a-1:
            flag = True
            break
        elif cou < a-1:
            cou += 1
            kuro[i][j] = "."

cou = 0
flag = False
for i in range(1,20,2):
    if flag:
        break
    for j in range(0,100,2):
        if cou >= b-1:
            flag = True
            break
        elif cou < b-1:
            cou += 1
            siro[i][j] = "

for i in range(20):
    for j in range(100):
        print(kuro[i][j],end="")
    print()
for i in range(20):
    for j in range(100):
        print(siro[i][j],end="")
    print()

Solution (Python):
import sys
import math
import copy
import random
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter



input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD

def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD

def fact_and_inv(SIZE):
    inv = [0] * SIZE  
    fac = [0] * SIZE  
    finv = [0] * SIZE  
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def renritsu(A, Y):
    
    
    
    A = np.matrix(A)
    Y = np.matrix(Y)
    Y = np.reshape(Y, (-1, 1))
    X = np.linalg.solve(A, Y)

    
    return X.flatten().tolist()[0]

class TwoDimGrid:
    
    def __init__(self, h, w, wall="
        self.h = h
        self.w = w
        self.size = (h+2) * (w+2)
        self.wall = wall
        self.get_grid()
        

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid
    def init_cost(self):
        self.cost = [INF] * self.size

    def pos(self, x, y):
        
        return y * (self.w + 2) + x
    def getgrid(self, x, y):
        return self.grid[y][x]
    def get(self, x, y):
        return self.cost[self.pos(x, y)]
    def set(self, x, y, v):
        self.cost[self.pos(x, y)] = v
        return
    def show(self):
        for i in range(self.h+2):
            print(self.cost[(self.w + 2) * i:(self.w + 2) * (i+1)])
    def showsome(self, tgt):
        for t in tgt:
            print(t)
        return
    def showsomejoin(self, tgt):
        for t in tgt:
            print("".join(t))
        return

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
        
        
        
        
        

def solve():
    a, b = getList()
    print(100, 100)
    for i in range(100):
        tmp = []
        for j in range(100):
            if i < 50:
                if j % 2 == 1 or i % 2 == 1 or  a <= 1:
                    tmp.append("
                else:
                    tmp.append(".")
                    a -= 1
            else:
                if j % 2 == 1 or i % 2 == 0 or b <= 1:
                    tmp.append(".")
                else:
                    tmp.append("
                    b -= 1

        print("".join(tmp))





def main():
    n = getN()
    for _ in range(n):
        s = "".join([random.choice(["F", "T"]) for i in range(20)])
        print(s)
        solve(s, 1, 0)

    return
if __name__ == "__main__":
    
    solve()

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

ans = [["

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

for i in range(b - 1):
  rows = (i // 50) * 2
  clms = (i % 50) * 2
  ans[99 - rows][clms] = "
  
print(100, 100)
for a in ans:
  print("".join(a))

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

ans = [["

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

for i in range(b - 1):
  rows = i // 50
  clms = (i % 50) * 2 + (rows % 2)
  ans[99 - rows * 2][clms] = "
  
print(100, 100)
for a in ans:
  print("".join(a))

Solution (Python):
a, b = map(int, input().split())
a -= 1
b -= 1
ans = [["
pos = 0
for i in range(a):
    x = pos % 90
    y = (pos // 90) * 2
    ans[y][x] = "."
    pos += 2

pos = 0
for j in range(b):
    x = pos % 90
    y = 45 +  (pos // 90) * 2
    ans[y][x] = "
    pos += 2
    
print(80, 90)
for row in ans:
    print("".join(row))

Solution (Python):
import sys
import math
import collections
import bisect
import itertools



sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7


ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))




def main():
    w, b = ns()
    l = 100
    mat = [["

    if w == 1 and b == 1:
        mat[0][0] = "."

    cnt = 0
    breakflg = False
    tmp = 1 if b > 1 else 0
    flg = False
    for i in range(0, l - 3, 3):
        for j in range(0, l - 3, 3):
            if not flg:
                if cnt < w - tmp:
                    around = "
                    center = "."
                else:
                    flg = True
                    break

            if flg:
                if cnt < w - tmp + b - 1:
                    around = "."
                    center = "
                else:
                    breakflg = True
                    break




            for n in range(3):
                for m in range(3):
                    mat[i + n][j + m] = center if n == 1 and m == 1 else around
            cnt += 1
        if breakflg:
            break

    print(l, l)
    for mi in mat:
        print(*mi, sep="")


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    A, B = in_nn()

    grid = [[''] * 100 for _ in range(100)]
    for y in range(100):
        for x in range(100):
            if 0 <= y < 50:
                grid[y][x] = '
            else:
                grid[y][x] = '.'

    for y in range(49):
        for x in range(100):
            if y % 2 == 0 and x % 2 == 0:
                if A > 1:
                    grid[y][x] = '.'
                    A -= 1

    for y in range(51, 100):
        for x in range(100):
            if y % 2 == 1 and x % 2 == 0:
                if B > 1:
                    grid[y][x] = '
                    B -= 1

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys

A, B = map(int, sys.stdin.readline().split())

"""
..........
..........
..........
に、連結にならないように黒を置いていく
白の場合も白黒を逆にして同じことをやれば良い
"""
A -= 1
B -= 1
print(100, 100)
for i in range(100):
    for j in range(100):
        
        if i < 50:
            if A > 0 and i % 2 == 0 and j % 2 == 0:
                print(".", end="")
                A -= 1
            else:
                print("
        
        elif 50 <= i:
            if B > 0 and i % 2 == 1 and j % 2 == 0:
                print("
                B -= 1
            else:
                print(".", end="")
        if j == 99:
            print("")

Solution (Python):



a, b = map(int, input().split())
retBW = [['
retWB = [['.']*100 for i in range(50)]
for i in range(0, 50, 2):
    for j in range(0, 100, 2):
        if a>1:
            retBW[i][j]='.'
            a -= 1

for i in range(1, 50, 2):
    for j in range(0, 100, 2):
        if b>1:
            retWB[i][j]='
            b -= 1

print('100 100')
for x in retBW:
    print(''.join(x))
for x in retWB:
    print(''.join(x))

Solution (Python):
a,b=list(map(lambda x:int(x)-1,input().split()))
m=[[0]*50+[1]*50 for i in range(100)]
x,y=-2,0
for i in range(a):
  x+=2
  if x==50:
    x=0
    y+=2
  m[y][x]=1
x,y=49,0
for i in range(b):
  x+=2
  if x==101:
    x=51
    y+=2
  m[y][x]=0

print(100,100)
for i in range(100):
  for j in range(100):
    print("."*m[i][j]+"
  print()

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




def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))


def main():
	a,b=MI()

	G=[]

	for _ in range(25):
		G+=[list("...

	



	for i in range(25):
		for j in range(24):
			if a<25**2:
				G[4*i][4*j+3]="."
				a+=1
			else:
				break


	for i in range(25):
		if a<25**2:
			G[4*i+3][0]="."
			a+=1
		else:
			break

	for i in range(25):
		for j in range(25):
			if b<25**2+1:
				G[4*i+1][4*j+1]="."
				b+=1

	print(100,100)







	for i in G:
		print(*i,sep="")















if __name__ == "__main__":
	main()

Solution (Python):
import sys

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


def resolve():
    a, b = map(int, input().split())
    res = [[""] * 100 for _ in range(100)]
    for i in range(100):
        for j in range(100):
            res[i][j] = "." if i < 50 else "

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

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

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


if __name__ == '__main__':
    resolve()

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

print('100 100')

flip = a > b

if flip:
    a, b = b, a

f = [['

i, j = (0, 0)

for _ in range(b-1):
    f[i][j+1] = '.'
    f[i+1][j+1] = '.'
    f[i+1][j] = '.'

    j += 2

    if j > 98:
        j = 0
        i += 2

i, j = (99, 0)

if b == 1:
    a += 1

for _ in range(a-1):
    f[i][j] = '.'
    j += 2

    if j > 98:
        j = 0
        i -= 2

if flip:
    for i in range(100):
        f[i] = list(map(lambda x: '.' if x == '

for row in f:
    print(''.join(row))

Solution (Python):
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    a, b = mi()
    print(100, 100)
    ans = [[] for i in range(100)]
    for i in range(50):
        for j in range(100):
            ans[i].append('
    for i in range(50, 100):
        for j in range(100):
            ans[i].append('.')

    for i in range(a - 1):
        ans[2 * (i // 50)][2 * (i % 50)] = '.'
    for i in range(b - 1):
        ans[99 - 2 * (i // 50)][2 * (i % 50)] = '

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


main()

Solution (Python):
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    a, b = mi()
    print(100, 100)
    ans = [[] for i in range(100)]
    for i in range(50):
        for j in range(100):
            ans[i].append('
    for i in range(50, 100):
        for j in range(100):
            ans[i].append('.')

    for i in range(a - 1):
        ans[2 * (i // 50)][2 * (i % 50)] = '.'
    for i in range(b - 1):
        ans[99 - 2 * (i // 50)][2 * (i % 50)] = '

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


main()

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache





MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b: a, b = b, a % b
    return a


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


def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





A,B = IL()
print(100,100)

for i in range(25):
  P = 50
  while P:
    if A>1:
      if P != 1:
        print(".
        A -= 1
      else:
        print(".
        A -= 1
    else:
      if P != 1:
        print("
      else:
        print("
    P -= 1
  print("

for i in range(25):
  P = 50
  print("."*100)
  while P:
    if B>1:
      if P != 1:
        print(".
        B -= 1
      else:
        print(".
        B -= 1
    else:
      if P != 1:
        print("..",end="")
      else:
        print("..")
    P -= 1

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache





MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b: a, b = b, a % b
    return a


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


def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





A,B = IL()
print(100,100)
A =["
B =["
for j in range(25):
  for i in range(50):
    print(A.pop(),end="")
    if i == 49:
      print("
    else:
      print("
  print("
for j in range(25):
  print("."*100)
  for i in range(50):
    print(B.pop(),end="")
    if i == 49:
      print(".")
    else:
      print(".",end="")

Solution (Python):
field = [['

a, b = map(int, input().split())
a-=1
b-=1
x = 0
y = 0
for _ in range(a):
    field[x][y] = '.'
    y += 2
    if y >= 100:
        y = 0
        x += 2

x = 99
y = 0
for _ in range(b):
    field[x][y] = '
    y += 2
    if y >= 100:
        y = 0
        x -= 2

print(100,100)
        
for row in field:
    print("".join(row))

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a,b = map(int,ipt().split())
    if a == 1 and b == 1:
        print(1,2)
        print(".
        exit()
    print(100,100)
    a -= 1
    b -= 1
    ni = 0
    while a >= 50:
        print(".
        print("
        ni += 2
        a -= 50
    print(".
    print("
    ni += 2
    for i in range(50-ni):
        print("
    ni = 0
    while b >= 50:
        print("."*100)
        print(".
        ni += 2
        b -= 50
    print("."*100)
    print(".
    ni += 2
    for i in range(50-ni):
        print("."*100)



    return

if __name__ == '__main__':
    main()

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

grid=[["

k=0
cnt=0
for i in range(a-1):
    grid[k][2*i-cnt]="."
    if (2*i)%100==n-2:
        k+=2
        cnt+=n

k=n//2+1
cnt=0
for i in range(b-1):
    grid[k][2*i-cnt]="
    if (2*i)%100==n-2:
        k+=2
        cnt+=n
print(100,100)
for i in grid:
    print("".join(i))

Solution (Python):





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

S = [["." if h < 50 else "

end_black = False
for i in range(0,50,2):
    if end_black:
        break
    for j in range(100):
        if B <= 1:
            end_black = True
            break
        
        if j % 2 == 0:
            S[i][j] = "
            B -= 1


end_white = False
for i in range(53,100, 2):
    if end_white:
        break
    for j in range(100):
        if A <= 1:
            end_white = True
            break
        
        if j % 2 == 0:
            S[i][j] = "."
            A -= 1

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

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

white = '.' * 100
black = '
wb = '.

ban = []

num_b = b - 1
num_a = a - 1

gyo_b = num_b // 50
ret_b = num_b % 50

gyo_a = num_a // 50
ret_a = num_a % 50

for i in range(gyo_a):
    ban.append(wb)
    ban.append(white)

ban.append(('.
ban.append(white)

for i in range(50 - 2 * (gyo_a + 1)):
    ban.append(white)

for i in range(50 - 2 * (gyo_b + 1)):
    ban.append(black)

for i in range(gyo_b):
    ban.append(wb)
    ban.append(black)

ban.append('.
ban.append(black)

print(100, 100)

for item in ban:
    print(''.join(item))

Solution (Python):


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

if a<=b:
    m = "."
    M = "
    mc = a
    Mc = b
else:
    m = "
    M = "."
    mc = b
    Mc = a
    
s = [[m]*100 for _ in range(100)]
tmp = [[M,M,M,m],
        [M,m,M,m],
      [M,M,M,m],
      [m,m,m,m]]
tmp2 = [[M,m,m,m],
        [m,m,m,m],
      [m,m,m,m],
      [m,m,m,m]]
i = 0
for i in range(mc-1):
    u,v = (i*4)//100, (i*4)%100
    u *= 4
    for x in range(4):
        for y in range(4):
            s[u+x][v+y] = tmp[x][y]

for j in range(i+1, i+1+(Mc-(mc-1))):
    u,v = (j*4)//100, (j*4)%100
    u *= 4
    for x in range(4):
        for y in range(4):
            s[u+x][v+y] = tmp2[x][y]
print(100,100)
print("\n".join(["".join(item) for item in s]))

Solution (Python):
w,b=map(int, input().split())
A,B,C,D=['
w-=1
b-=1
print(100,50)
for i in range(100):
  if i<50:
    if i%2==1:
      print(*A*25,sep='')
    elif w>=25 and i%2==0:
      print(*C*25,sep='')
      w-=25
    else:
      E=C*w+A*(25-w)
      print(*E,sep='')
      w=0
  else:
    if i%2==0:
      print(*B*25,sep='')
    elif b>=25 and i%2==1:
      print(*D*25,sep='')
      b-=25
    else:
      F=D*b+B*(25-b)
      print(*F,sep='')
      b=0