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,b = map(int, input().split())
grid = [["."  for j in range(100) ] for i in range(100)]
for v in range(w-1):
    i,j = v//25, v%25
    for t in range(4):
        grid[i*4 + 3][j*4 + t] = "
        grid[i*4+t][j*4+3] = "
for v in range(b-1 if w != 1 else b):
    i,j = v//25, v%25
    grid[i*4+1][j*4+1] = "
print(100, 100)
for v in grid:
    print("".join(v))

Solution (Python):


a,b = [int(x) for x in input().split()]

a,b = a-1,b-1

H,W = 100,100


masu = [["." for i in range(100)] for _ in range(100)]
for h in range(100):
    for i in range(100):
        if i < 50:
            masu[h][i] = "

def white(masu):
    count = 0
    for i in range(500):
        for h in range(50):
            if a <= count:
                return masu
            count+=1
            masu[2*h][2*i] = "."
            

def black(masu):
    count = 0
    for i in range(500):
        for h in range(50):
            if b <= count:
                return masu
            count+=1
            masu[2*h][99 - 2*i] = "
            

def output(masu):
    for line in masu:
       print("".join(line))

print(str(H)+" "+str(W))

masu = white(masu)
masu = black(masu)
output(masu)

Solution (Python):
def m():
    a, b = map(int, input().split())
    
    grid = [[0]*100 for _ in range(100)]
    k = 50
    for i in range(k):
        for j in range(k*2):
            grid[i][j] = 1

    for i in range(k-1):
        if i % 2 == 0:ind = 0
        else:continue

        while ind < 100 and a-1 > 0:
            grid[i][ind] = 0
            ind += 2
            a -= 1
        if a-1 <= 0:
            break

    for i in range(k*2-1, k,-1):
        if i % 2 == 1:ind = 1
        else:continue

        while ind < 100 and b-1 > 0:
            grid[i][ind] = 1
            ind += 2
            b -= 1
        if b-1 <= 0:
            break

    print("100 100")
    for i in range(k*2):
        for j in range(k*2):
            if grid[i][j] == 0:
                print(".", end="")
            else:
                print("
        print("")
m()

Solution (Python):
a, b = map(int, input().split())
grid = [list("." * 100) if i < 50 else list("
a -= 1
b -= 1

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

for i in range(51, 100, 2):
  if a == 0:
    break
  turn = i % 2
  for j in range(0, 100, 2):
    grid[i][j] = "."
    a -= 1
    if a == 0:
      break
print(len(grid[0]), len(grid))
for line in grid:
  print("".join(line))

Solution (Python):
h, w = 66, 65
a, b = map(int,input().split())

c = [['

for i in range(a-1):
    c[i//((h-1)//2)*2+1][i%((h-1)//2)*2+1] = '.'
for i in range(b-1):
    c[i//((h-1)//2)*2+h//2+1][i%((h-1)//2)*2+1] = '


print(h,w)
for i in range(h):
    for j in range(w):
        print(c[i][j],end='')
    print()

Solution (Python):
W,B=map(int,input().split())
U,D=['
for i in range(W-1):U[i*2]='.'
for i in range(B-1):D[i*2]='
print(80,50)
for x in range(20):print(''.join(U[x*50:-~x*50])+'\n'+'
for x in range(20):print('.'*50+'\n'+''.join(D[x*50:-~x*50]))

Solution (Python):
W,B=map(int,input().split())
U=['
D=['.']*1234
for i in range(W-1):U[i*2]='.'
for i in range(B-1):D[i*2]='
print(80,51)
for x in range(20):print(''.join(U[x*51:-~x*51])+'\n'+'
for x in range(20):print('.'*51+'\n'+''.join(D[x*51:-~x*51]))

Solution (Python):
a,b=map(int,input().split())
k=32
m=2*k
grid=[['
grid=grid+[['.' for i in range(m)] for i in range(k)]

for i in range(m*k):
  if a==1:
    break
  grid[2*int(i*2/m)][(i*2)%m]='.'
  a-=1

for i in range(m*k):
  if b==1:
    break
  grid[k+1+2*int(i*2/m)][(i*2)%m]='
  b-=1

print(str(2*k)+' '+str(2*k))
for i in range(k*2):
  print(''.join(grid[i]))

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

x, y = '.', '
if a > b:
    a, b = b, a
    x, y = y, x

space = [[x for _ in range(100)] for _ in range(100)]

for z in range(b):
    i, j = divmod(z, 25)
    for di in range(3):
        for dj in range(3):
            space[i*4+di][j*4+dj] = y

for z in range(a-1):
    i, j = divmod(z, 25)
    space[i*4+1][j*4+1] = x

print("100 100")
print('\n'.join((''.join(row)) for row in space))

Solution (Python):
import math

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

C=sorted([A,B])
n=100
h=n
w=n


List=[None]*n
for i in range(n):
    List[i]=[0]*n
 
Col=n//4-1

for i in range(C[1]):
    hh=i//(Col)
    ww=i-hh*(Col)

    if ww%2==0:
         List[(hh+1)*4-1][ww*4]=1
         List[(hh+1)*4-1][ww*4+1]=1
         List[(hh+1)*4-1][ww*4+2]=1
         List[(hh+1)*4-1][ww*4+3]=1


    if ww%2==1:
        List[(hh+1)*4][ww*4]=1
        List[(hh+1)*4][ww*4+1]=1
        List[(hh+1)*4][ww*4+2]=1
        List[(hh+1)*4][ww*4+3]=1

            


for i in range(C[0]-1):
    hh=i//(Col)
    ww=i-hh*(Col)
    if hh==0:
        if ww%2==0:
            List[(hh+1)*4-2][ww*4+2]=1
            List[(hh+1)*4-3][ww*4+2]=1
            List[(hh+1)*4-4][ww*4+2]=1
        if ww%2==1:
            List[(hh+1)*4-1][ww*4+2]=1
            List[(hh+1)*4-2][ww*4+2]=1
            List[(hh+1)*4-3][ww*4+2]=1
            List[(hh+1)*4-4][ww*4+2]=1
    
    else:
        if ww%2==0:
            List[(hh+1)*4-2][ww*4+2]=1
            List[(hh+1)*4-3][ww*4+2]=1
            List[(hh+1)*4-4][ww*4+1]=1

        if ww%2==1:
            List[(hh+1)*4-1][ww*4+2]=1
            List[(hh+1)*4-2][ww*4+2]=1
            List[(hh+1)*4-3][ww*4+1]=1

print(h,w)

if A<=B:
    for i in range(n):
        for j in range(n):
            if List[i][j]==0:
                print(".",end="")
            else:
                print("

        if i!=n:
            print("")

else:
    for i in range(n):
        for j in range(n):
            if List[i][j]==0:
                print("
            else:
                print(".",end="")

        if i!=n:
            print("")

Solution (Python):
from __future__ import print_function

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

h = 101
w = 101

grid = [['.' for i in xrange(w)] for j in xrange(h)]

for i in xrange(51, h):
    for j in xrange(1, w):
        grid[i][j] = '

cnt = a - 1 

for i in xrange(52, h, 2):
    for j in xrange(1, w, 2):
        if cnt == 0: break
        grid[i][j] = '.'
        cnt -= 1
        
    if cnt == 0: break

cnt = b - 1 

for i in xrange(1, h, 2):
    for j in xrange(1, w, 2):
        if cnt == 0: break
        grid[i][j] = '
        cnt -= 1
        
    if cnt == 0: break

print(100, 100)
for i in xrange(1, h):
    for j in xrange(1, w):
        print(grid[i][j], end = "")
    print()

Solution (Python):
A, B = map(int, input().split())
L = [["."] * 99 + ["
for i in range(B-1):
    L[1 + i%50 * 2][2 + i//50 * 2] = "."
for i in range(A-1):
    L[-2 - i%50 * 2][-3 - i//50 * 2] = "
print("100 100")
for s in L:
    print("".join(s))

Solution (Python):
A,B = map(int,input().split())
grid = 100
tizu = []
for i in range(grid):
  tori = ["."] * 100
  tizu.append(tori)
a = 0
b = 0
if A == 1:
  tizu[1][0] = "
while A > 1:
  tizu[0+b][1+a] = "
  tizu[1+b][0+a] = "
  tizu[1+b][1+a] = "
  a += 2
  A -= 1
  if a >= 98:
    b += 2
    a = 0
a = 0
b = 0
while B > 1:
  tizu[99-b][0+a] = "
  a += 2
  B -= 1
  if a >= 98:
    b += 2
    a = 0
print(grid,grid)
for i in range(grid):
  print(''.join(tizu[i]))

Solution (Python):
from itertools import product

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

k = 50
s = [['.' for i in range(k)] + ['

na = 1
for i, j in product(range(1, 2 * k - 1, 2), range(k + 1, 2 * k - 1, 2)):
    if na >= a:
        break
    s[i][j] = '.'
    na += 1

nb = 1
for i, j in product(range(1, 2 * k - 1, 2), range(1, k - 1, 2)):
    if nb >= b:
        break
    s[i][j] = '
    nb += 1

print(k * 2, k * 2)
for row in s:
    print(''.join(row))

Solution (Python):
a, b = map(int, input().split())
ans = []
def paintW():
  a_count = 1
  for i in range(50, 100):
    if a_count == a:
      return
    for j in range(1, 101):
      if not ans[i+1][j] == '.' and not ans[i-1][j] == '.' and not ans[i][j+1] == '.' and not ans[i][j-1] == '.' and not ans[i-1][j-1] == '.' and not ans[i-1][j+1] == '.' and not ans[i+1][j-1] == '.' and not ans[i+1][j+1] == '.':
        ans[i][j] = '.'
        a_count += 1
      if a_count == a:
        return
def paintB():
  b_count = 1
  if b_count == b:
    return
  for i in range(1, 50):
    for j in range(1, 101):
      if not ans[i+1][j] == '
        ans[i][j] = '
        b_count += 1
      if b_count == b:
        return
ans.append(['*']*102)
for i in range(50):
  ans.append(['*'] + ['.']*100 + ['*'])

for i in range(50):
  ans.append(['*'] + ['
ans.append(['*']*102)

paintB()
paintW()

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

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

grid = []

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

for i in range(B-1):
    grid[99 - 2*(i//50)][(i*2)%100] = "
    
print("100 100")
for i in grid:
    p = "".join(i)
    print(p)

Solution (Python):
A, B = map(int, input().split())
print(100, 100)
ans = [["."]*50 + ["


for a in range(A - 1):
    ans[2*(a // 25)][99 - 2*(a % 25)] = "."
for b in range(B - 1):
    ans[2*(b // 25)][2*(b % 25)] = "
for l in ans:
    print("".join(l))

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

masu = [['
for i in range(50, 100):
    for j in range(100):
        masu[i][j] = '.'
cnta = 0
for i in range(0, 50):
    for j in range(99):
        if cnta < a-1 and j % 3 == 1:
            masu[i][j+i % 2] = '.'
            cnta += 1
cntb = 0
for i in range(51, 100):
    for j in range(99):
        if cntb < b-1 and j % 3 == 1:
            masu[i][j+i % 2] = '
            cntb += 1

print('100 100')
for i in range(100):
    for j in range(100):
        print(masu[i][j], end='')
    print('')

Solution (Python):
A, B = map(int, input().split())
print(100, 100)
ans = [["."]*50 + ["
for a in range(A - 1):
    ans[2*(a // 25)][99 - 2*(a % 25)] = "."
for b in range(B - 1):
    ans[2*(b // 25)][2*(b % 25)] = "
for l in ans:
    print("".join(l))

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

d = {}
for i in range(50):
    d[i] = ["."]*100
for i in range(50,100):
    d[i] = ["
a = 1
b = 1

for i in range(10):
    if a == B:
        break
    for j in range(50):
        if a == B:
            break
        else:
            d[i*2][j*2] = "
            a += 1
    
        
        
for i in range(10):
    if b == A:
        break
    for j in range(50):
        if b == A:
            break
        else:
            d[i*2+51][j*2] = "."
            b += 1
    

print("100 100")
def l_to_str(l):
    s = ""
    for x in l:
        s+=x
    return s
for i in range(100):
    print(l_to_str(d[i]))

Solution (Python):
def read():
    return int(input())


def readlist():
    return list(map(int, input().split()))


def readmap():
    return map(int, input().split())


A, B = readmap()

print(100, 100)

arr = [["."] * 50 + ["

for a in range(1, A):
    arr[2 * (a // 20) + 1][2 * (a % 20) + 51] = "."

for b in range(1, B):
    arr[2 * (b // 20) + 1][2 * (b % 20) + 1] = "

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

Solution (Python):
a, b = map(int, raw_input().split())
w, h = 100, 100
grid = [list("
d = (w/2-1)/2
for i in range(a-1):
    r = 2*(i / d)
    c = 2*(i % d)
    grid[r][c] = "."
for i in range(b-1):
    r = 2*(i / d)
    c = w-1-2*(i % d)
    grid[r][c] = "
print "%d %d" % (w,h)
print "\n".join(map("".join,grid))

Solution (Python):
A,B=map(int,input().split())
UP=[["
DN=[["."]*100 for _ in range(50)]
i,j=0,0
a=1

while a<A:
    UP[j][i]="."
    a+=1
    i+=2
    if i>=100:
        j+=2
        i=0
i,j=0,1
b=1

while b<B:
    DN[j][i]="
    b+=1
    i+=2
    if i>=100:
        j+=2
        i=0
print("{} {}".format(100, 100))
print("\n".join("".join(i) for i in UP))
print("\n".join("".join(i) for i in DN))

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

grid = [['.' for i in range(2*K)] for j in range(2*K)]

for i in range(K,2*K):
    for j in range(2*K):
        grid[i][j]='
bcnt=0
wcnt=0

for i in range(1,K,2):
    for j in range(0,2*K,2):
        if bcnt < B-1:
            grid[i][j]='
            bcnt += 1
for i in range(K+1,2*K,2):
    for j in range(0,2*K,2):
        if wcnt < A-1:
            grid[i][j]='.'
            wcnt +=1

print(2*K,2*K)
for i in range(2*K):
    row_grid=''.join(grid[i])
    print(row_grid)

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

lineA=int(A/50)
line = '.
print(100,100)
for i in range(lineA):
    print(line)
    print('

if A%50!=0:
    print('.
    print('
    for _ in range(48-2*lineA):
        print('
else:
    for _ in range(49-2*lineA):
        print('

print('
print('.'*100)

lineB=int(B/50)

for _ in range(lineB):
    print('
    print('.'*100)

if B%50!=0:
    print('
    print('..'*(50-B%50))
    for _ in range(48-2*lineB):
        print('.'*100)
else:
    for _ in range(49-2*lineB):
        print('.'*100)

Solution (Python):
A,B = map(int,input().split())
X = []
for i in range(100):
    defC = "." if i<50 else "
    line = [defC for _ in range(100)]
    X.append(line)

h,w = (B-1)//50,(B-1)%50
for i in range(h):
    for j in range(50):
        X[i*2][j*2] = "
for i in range(w):
    X[h*2][i*2] = "

h,w = (A-1)//50,(A-1)%50
for i in range(h):
    for j in range(50):
        X[i*2+51][j*2] = "."
for i in range(w):
    X[h*2+51][i*2] = "."

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

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

space = [0 for i in range(100*100)]

for i in range(len(space)):
    if i >= 5000:
        space[i] = 1

while(True):
    for i in range(0,5000,6):
        if a > 1:
            space[i] = 1
            a -= 1
        else:
            break

    for j in range(5000,10000,6)[::-1]:
        if b > 1:
            space[j] = 0
            b -= 1
        else:
            break

    if a == 1 and b == 1:
        break

ans = ""

for (i,cell) in enumerate(space):
    if i % (100*(i//100)+99) == 0 and i != 0:
        if cell == 0:
            ans = ans + "
        else:
            ans = ans + ".\n"
    else:
        if cell == 0:
            ans = ans + "
        else:
            ans = ans + "."
print(100,100)
print(ans)

Solution (Python):
a,b=list(map(int,input().split()))
result=['
for i in range(50):
    result[i]='.'*100
hup=(b-1)//50
hdown=(a-1)//50
wup=(b-1)%50
wdown=(a-1)%50
for i in range(hup):
    result[i*2]='.
result[hup*2]='.
for i in range(hdown):
    result[i*2+51]='
result[hdown*2+51]='
print(100,100)
for i in range(100):
    print(result[i])

Solution (Python):
b,a = map(int,input().split())
lis = []
for i in range(50):
	g = []
	for m in range(100):
		g.append(".")
	lis.append(g)
for i in range(50):
	g = []
	for m in range(100):
		g.append("
	lis.append(g)
cou = 0
co = 0
for k in range(a-1):
	lis[cou][co] = "
	co += 2
	if co >= 100:
		co = 0
		cou += 2
cou = 51
co = 0
for h in range(b-1):
	lis[cou][co] = "."
	co += 2
	if co >= 100:
		co = 0
		cou += 2
print("100 100")
for m in range(100):
	print("".join(lis[m]))

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

table = []

whites = 1
blacks = 1


for i in range(50):
  table += [[]]
  if i % 2 == 1:
    table[i] = ['
    continue
  
  for j in range(100):
    if whites < a and j % 2 == 0:
      table[i] += ['.']
      whites += 1
    else:
      table[i] += ['
  
  if whites >= a:
    break

table += [['

parity = len(table) % 2
for i in range(len(table), 100):
  table += [[]]
  if i % 2 == parity:
    table[i] = ['.' for i in range(100)]
    continue

  for j in range(100):
    if blacks < b and j % 2 == 0:
      table[i] += ['
      blacks += 1
    else:
      table[i] += ['.']
  
  if blacks >= b:
    break

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

Solution (Python):
def print_grid(table):
    for t in table:
        temp = ''.join(t)
        temp = temp.replace('1','
        temp = temp.replace('0','.')
        print(temp)

A, B = map(int, input().split())
h=100
w = 100
K = 50
table = [['0' for i in range(h)] for j in range(w)]
for i in range(K) :
    for j in range(w):
        table[i][j] = '1'
x,y = 0,0
for a in range(A-1):
    table[x][y] = '0'
    y = y + 2
    if(y > 99):
        y = 0
        x = x + 2
x,y = 51,0
for b in range(B-1):
    table[x][y] = '1'
    y = y + 2
    if(y > 99):
        y = 0
        x += 2
print('100 100')
print_grid(table)

Solution (Python):
def print_grid(table):
    for t in table:
        temp = ''.join(t)
        temp = temp.replace('1','
        temp = temp.replace('0','.')
        print(temp)

A, B = map(int, input().split())
h=100
w = 100
K = 50
table = [['0' for i in range(h)] for j in range(w)]
for i in range(K) :
    for j in range(w):
        table[i][j] = '1'
x,y = 0,0
for a in range(A-1):
    table[x][y] = '0'
    y = y + 2
    if(y > 99):
        y = 0
        x = x + 2
x,y = 51,0
for b in range(B-1):
    table[x][y] = '1'
    y = y + 2
    if(y > 99):
        y = 0
        x += 2
print('100 100')
print_grid(table)

Solution (Python):
A,B = map(int,input().split())
grid = [["." for i in range(0,100)] for j in range(0,100)]
for j in range(50,100):
    for i in range(0,100):
        grid[j][i] = "
for count in range(0,B-1):
    x = (count*2)%100
    y = ((count*2)//100)*2
    grid[y][x] = "
for count in range(0,A-1):
    x = (count*2)%100
    y = ((count*2)//100)*2
    grid[y+51][x] = "."
print("100 100")
for j in range(0,100):
    for i in range(0,100):
        if i != 99:
            print(grid[j][i],end ="")
        else:
            print(grid[j][i])

Solution (Python):
WHITE = '.'
BLACK = '

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

remain_white = A-1
remain_black = B-1

print("100 100")
for i in range(25):
    print(BLACK*100)
    if remain_white >= 50:
        print((WHITE+BLACK)*50)
        remain_white -= 50
    else:
        print((WHITE+BLACK)*remain_white + BLACK*(100-remain_white*2))
        remain_white = 0

for i in range(25):
    print(WHITE*100)
    if remain_black >= 50:
        print((WHITE+BLACK)*50)
        remain_black -= 50
    else:
        print((WHITE+BLACK)*remain_black + WHITE*(100-remain_black*2))
        remain_black = 0

Solution (Python):
a,b = map(int, input().split())
w = 100
h = 20
grid = []
for _ in range(h):
    grid.append(['
for _ in range(h):
    grid.append(['.' for i in range(w)])
n = 0
for i in range(0,a-1):
    if i % 50 == 0 and i != 0:
        n += 2
    grid[n][2*(i % 50)] = '.'

n = h+1
for i in range(0,b-1):
    if i % 50 == 0 and i != 0:
        n += 2
    grid[n][2*(i % 50)] = '

print(2*h,w)
for i in range(2*h):
    print(''.join(grid[i]))

Solution (Python):

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

s = ''

W = '.'
B = '
N = '\n'

h = 0




while a>=51:
    s += (B+W)*50 + N
    s += B*100 + N
    h += 2
    
    a -= 50


a -= 1

s += B*100 + N
s += (B+W)*a + (B+B)*(50-a) + N
s += B*100 + N
h += 3


s += W*100 + N
h += 1


while b >= 51:
    s += (B+W)*50 + N
    s += W*100 + N
    h += 2
    
    b -= 50


b -= 1
    
s += (B+W)*b + (W+W)*(50-b) + N
h += 1


print(h, 100)
print(s)

Solution (Python):
import numpy as np
a,b = map(int, input().split())
grid1 = [['.' for j in range(100)] for i in range(50)]
grid2 = [['
a -= 1
b -= 1
x = y = 1

for i in range(a):
    grid2[x][y] = '.'
    y += 2
    if y != y % 100:
        x += 2
    y = y % 100
    if x >= 50 or y >= 100:break

x = y = 1
for i in range(b):
    grid1[x][y] = '
    y += 2
    if y != y % 100:
        x += 2
    y = y % 100
    if x >= 50 or y >= 100:break

print(100, 100)
grid = np.concatenate((grid1, grid2), axis=0)
for row in grid:
    print(''.join(row))

Solution (Python):
import numpy as np
import math

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

h = 100
w = 100

char_white = '.'
char_black = '

fields_w = [[char_white for _ in range(int(w/2))] for _ in range(h)]
fields_b = [[char_black for _ in range(int(w/2))] for _ in range(h)]

spaces_per_row = math.ceil((int(w/2) - 2) / 2.0)

for i in range(a - 1):
    col = i % spaces_per_row
    row = i // spaces_per_row
    fields_b[row * 2 + 1][col * 2 + 1] = char_white

for i in range(b - 1):
    col = i % spaces_per_row
    row = i // spaces_per_row
    fields_w[row * 2 + 1][col * 2 + 1] = char_black

res = np.concatenate((fields_w, fields_b), 1)

print(str(h) + ' ' + str(w))
for row in res:
    print(''.join(row))

Solution (Python):
a,b = (int(i) for i in input().split())
print(100,100)
x,y = a-1,b-1
for i in range(50):
	if i%2==0:
		if x>=50:
			print("
			x -= 50
		else:
			print("
			x = 0
	else: print("
for i in range(50):
	if i%2==1:
		if y>=50:
			print(".
			y -= 50
		else:
			print(".
			y = 0
	else: print("."*100)

Solution (Python):
def check(i, j, c):
    if grid[i - 1][j - 1] != c and grid[i][j - 1] != c and grid[i + 1][j - 1] != c and grid[i - 1][j] != c and grid[i + 1][j] != c and grid[i - 1][j + 1] != c and grid[i][j + 1] != c and grid[i + 1][j + 1] != c:
        return True
    else:
        return False

def change(N, c):
    k = 0
    if c == "
        k = 50
    for i in range(1 + k, 49 + k):
        for j in range(1, 99):
            if check(i, j, c):
                grid[i][j] = c
                N -= 1
            if N == 1:
                break
        if N == 1:
            break

A, B = map(int, input().split())
grid = [["
print(100, 100)
if A > 1:
    change(A, ".")
if B > 1:
    change(B, "
for g in grid:
    print("".join(g))

Solution (Python):

import copy

a,b = map(int, raw_input().split())
h_max = 40
w_max = 100
ans = []
buff = [ "." for i in range(w_max)]
buff2 = [ "
for j in range(h_max/2):
    tmp = copy.deepcopy(buff)
    ans.append(tmp)
for j in range(h_max/2):
    tmp = copy.deepcopy(buff2)
    ans.append(tmp)

h = h_max
w = w_max
a = a - 1
b = b - 1

px = 0
py = 0
while b > 0:
    b = b - 1
    ans[py][px] = "
    px = px + 2
    if px > w_max - 1:
        py = py + 2
        px = 0


px = 0
py = h_max / 2 + 1
while a > 0:
    a = a - 1
    ans[py][px] = "."
    px = px + 2
    if px > w_max - 1:
        py = py + 2
        px = 0


print("{} {}".format(h, w))
for j in range(h):
    print ''.join(ans[j])

Solution (Python):
def changeblack(a,n):
    t = n
    for i in range(0,49,2):
        for j in range(0,100,2):
                if t > 0:
                    a[i][j] = '.'
                    t -= 1
    return a
 
def changewhite(a,n):
    t = n
    for i in range(51,100,2):
        for j in range(0,100,2):
                if t > 0:
                    a[i][j] = '
                    t -= 1
    return a

A, B = [int(i) for i in input().split()];
 
A -= 1;
B -= 1;
 
def list_2d(H, W, v) :
    return [[v for i in range(W)] for j in range(H)];
 
ans = list_2d(50, 100, '
ans = changeblack(ans,A)
ans = changewhite(ans,B)
print('100 100')
for i in range(0,100):
    for j in range(0,99):
        print(ans[i][j],end = "")
    print(ans[i][99])

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

A -= 1;
B -= 1;

def list_2d(H, W, v) :
    return [[v for i in range(W)] for j in range(H)];

ans = list_2d(50, 100, '

for i in range(1, 50, 2) :
    for j in range(1, 100, 2) :
        if (A) :
            ans[i][j] = '.';
            A -= 1;

for i in range(51, 100, 2) :
    for j in range(1, 100, 2) :
        if (B) :
            ans[i][j] = '
            B -= 1;

print(100, 100);
for i in ans :
    for j in i :
        print(j, end = '');
    print();

Solution (Python):
h, w = 100, 100
ans = [[0] * w for i in range(h)]
a, b = map(lambda x: int(x) - 1, input().split())
table = [['.' if i % 2 == 0 else '
for i in range(w):
    table[0][i] = '.'
    table[99][i] = '

for i in range(0, 98, 2):
    for j in reversed(range(1, 98, 2)):
        if a == 0:
            break
        table[j][i] = '
        a -= 1
    else:
        continue
    break

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

print(h, w)
print('\n'.join([''.join(t) for t in table]))

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

A -= 1;
B -= 1;

ans = [['

for i in range(1, 50, 2) :
    for j in range(1, 100, 2) :
        if (A) :
            ans[i][j] = '.';
            A -= 1;

for i in range(51, 100, 2) :
    for j in range(1, 100, 2) :
        if (B) :
            ans[i][j] = '
            B -= 1;

print(100, 100);
for i in ans :
    for j in i :
        print(j, end = '');
    print();

Solution (Python):
import sys
 
Tmp = []
Tmp = input().rstrip().split(' ')
A = int(Tmp[0])
B = int(Tmp[1])



print('100 100')

for i in range(50):
    for j in range(100):
        if i==0:
            print('.', end='')
            if  j==99:
                print()
               
            continue
        
        if j==0:
            print('.', end='')
            continue
        elif j==99:
            print('.', end='')
            print()
            continue
        else:
            Tmp1 = i % 2
            Tmp2 = j % 2
            
            if (Tmp1 == 1) and (Tmp2 == 1) and (B > 1):
                print('
                B -= 1
            else:
                print('.', end='')
                
for i in range(50):
    for j in range(100):
        if i==0:
            print('
            if  j==99:
                print()
            continue
        
        if j==0:
            print('
            continue
        elif j==99:
            print('
            print()
            continue
        else:
            Tmp1 = i % 2
            Tmp2 = j % 2
            
            if (Tmp1 == 1) and (Tmp2 == 1) and (A > 1):
                print('.', end='')
                A -= 1
            else:
                print('

Solution (Python):
A,B=map(int,input().split())
C=[[0 for i in range(100)] for i in range(100)]
for i in range(50,100):
    for j in range(100):
        C[i][j]=1
k=0
for i in range(50):
    for j in range(100):
        if (i*j)%2 ==1:
            if k<A-1:
                C[i][j]=1
                k+=1
            else:
                break
k=0
for i in range(50,100):
    for j in range(100):
        if (i*j)%2 ==1:
            if k<B-1:
                C[i][j]=0
                k+=1
            else:
                break
print(100,100)
for i in range(100):
    st=""
    for j in range(100):
        if C[i][j]==0:
            st+="
        else:
            st+="."
    print(st)

Solution (Python):
import copy
A,B=map(int,raw_input().split())
h=100
w=100
t=list("
l=[ copy.deepcopy(t) for i in range(h)]

A-=1
B-=1

flag=0

if A>0:
	for x in range(1,h,2):
		if flag==1: break
		for y in range(1,w/2-1,2):
			l[x][y]="."
			A-=1
			if A==0:
				flag=1
				break

	
flag=0

if B>0:
	for x in range(1,h,2):
		if flag==1: break
		for y in range(w/2+1,w-1,2):
			l[x][y]="
			B-=1
			if B==0:
				flag=1
				break

print "100 100"
for i in l:
	print "".join(i)

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

    n_locatable_elements = (49 - 1) // 2 + 1
    for i in range(A - 1):
        x = 2 * (i % n_locatable_elements)
        y = 2 * (i // n_locatable_elements) + 1
        grid[y][x] = "."

    for i in range(B - 1):
        x = 2 * (i % n_locatable_elements) + 50 + 1
        y = 2 * (i // n_locatable_elements) + 1
        grid[y][x] = "

    print("100 100")
    for row in grid:
        print("".join(row))

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

white = [["
black = [["."] * 100 for i in range(50)]
A, B = A-1, B-1

row = 0
line = 0

for i in range(A):
	white[line][row] = "."
	row += 2
	if row >=100:
		row = 0
		line += 2

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

ans = white + black
print(100, 100)
for a in ans:
	print("".join(a))

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

    white = [['.' for _ in [0] * 100] for _ in [0] * 50]
    black = [['
    paint(black, A)
    paint(white, B)

    print(100, 100)
    for wb in (white, black):
        for c in wb:
            print(*c, sep='')

def paint(color, n):
    if n == 1:
        return
    if color[0][0] == '.':
        char = '
    else:
        char = '.'
    for i in range(1, 50, 2):
        for j in range(1, 100, 2):
            color[i][j] = char
            n -= 1
            if n == 1:
                return

main()

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

a2,a3=(a-1)//50,(a-1)%50
for i in range(0,2*a2,2):
    for j in range(0,100,2):
        s[i][j]="."
for i in range(0,2*a3,2):
    s[2*a2][i]="."

b2,b3=(b-1)//50,(b-1)%50
for i in range(2,2*b2+2,2):
    for j in range(0,100,2):
        t[i][j]="
for i in range(0,2*b3,2):
        t[2*b2+2][i]="
print(100,100)
for i in range(50):
    print("".join(s[i]))
for i in range(50):
    print("".join(t[i]))

Solution (Python):
a,b=map(int, input().split(" "))
wh="."
bl="
print(100,100)
for i in range(100):
    out=""
    if i%2==0:
        for k in range(50):
            out+=bl
        for k in range(50):
            out+=wh
    else:
        for i in range(25):
            if a > 1:
                out+=wh
                a-=1
            else:
                out+=bl
            out+=bl

        for i in range (25):
            out+=wh
            if b > 1:
                out+=bl
                b-=1
            else:
                out+=wh

    print(out)