L = []



H, W = list(map(int, input().split()))

for i in range(H):

	S = list(eval(input()))

	L.append(S)



ans1 = [[0 for i in range(W)] for j in range(H)]

ans2 = [[0 for i in range(W)] for j in range(H)]



for i in range(H):

	val = 0

	l = []

	for j in range(W):

		if L[i][j] == "#":

			for k in l:

				ans1[i][k] = val

			val = 0

			l = []

		else:

			val += 1

			l.append(j)

	for k in l:

		ans1[i][k] = val



for i in range(W):

	val = 0

	l = []

	for j in range(H):

		if L[j][i] == "#":

			for k in l:

				ans2[k][i] = val

			val = 0

			l = []

		else:

			val += 1

			l.append(j)

	for k in l:

		ans2[k][i] = val





ans = -1

for i in range(H):

	for j in range(W):

		x = ans1[i][j] + ans2[i][j] - 1

		if x > ans:

			ans = x



print(ans)
H, W = list(map(int, input().split()))

S = [[0]*W for _ in range(H)]



for i in range(H):

    Si = list(eval(input()))

    for j in range(W):

        if Si[j] == '#':

            S[i][j] = 1



# row

S_row = [[0]*W for _ in range(H)]

for i in range(H):

    c = 0

    for j in range(W):

        if S[i][j] == 1:

            c = 0

        else:

            c += 1

        S_row[i][j] = c

    # reverse

    for j in range(W-2, -1, -1):

        if S_row[i][j+1] > 0 and S_row[i][j] > 0:

            S_row[i][j] = S_row[i][j+1]



# col

S_col = [[0]*W for _ in range(H)]

for j in range(W):

    c = 0

    for i in range(H):

        if S[i][j] == 1:

            c = 0

        else:

            c += 1

        S_col[i][j] = c

    # reverse

    for i in range(H-2, -1, -1):

        if S_col[i+1][j] > 0 and S_col[i][j] > 0:

            S_col[i][j] = S_col[i+1][j]



# res

res = max([max([S_row[i][j] + S_col[i][j] - 1 for j in range(W)]) for i in range(H)])

print(res)
L = []
H, W = list(map(int, input().split()))
for i in range(H):
    S = list(eval(input()))
    L.append(S)
ans1 = [[0 for i in range(W)] for j in range(H)]
ans2 = [[0 for i in range(W)] for j in range(H)]
for i in range(H):
    val = 0
    l = []
    for j in range(W):
        if L[i][j] == "#":
            for k in l:
                ans1[i][k] = val
            val = 0
            l = []
        else:
            val += 1
            l.append(j)
    for k in l:
        ans1[i][k] = val
for i in range(W):
    val = 0
    l = []
    for j in range(H):
        if L[j][i] == "#":
            for k in l:
                ans2[k][i] = val
            val = 0
            l = []
        else:
            val += 1
            l.append(j)
    for k in l:
        ans2[k][i] = val
ans = -1
for i in range(H):
    for j in range(W):
        x = ans1[i][j] + ans2[i][j] - 1
        if x > ans:
            ans = x
print(ans)

H, W = list(map(int, input().split()))
S = [[0] * W for _ in range(H)]
for i in range(H):
    Si = list(eval(input()))
    for j in range(W):
        if Si[j] == "#":
            S[i][j] = 1
# row
S_row = [[0] * W for _ in range(H)]
for i in range(H):
    c = 0
    for j in range(W):
        if S[i][j] == 1:
            c = 0
        else:
            c += 1
        S_row[i][j] = c
    # reverse
    for j in range(W - 2, -1, -1):
        if S_row[i][j + 1] > 0 and S_row[i][j] > 0:
            S_row[i][j] = S_row[i][j + 1]
# col
S_col = [[0] * W for _ in range(H)]
for j in range(W):
    c = 0
    for i in range(H):
        if S[i][j] == 1:
            c = 0
        else:
            c += 1
        S_col[i][j] = c
    # reverse
    for i in range(H - 2, -1, -1):
        if S_col[i + 1][j] > 0 and S_col[i][j] > 0:
            S_col[i][j] = S_col[i + 1][j]
# res
res = max([max([S_row[i][j] + S_col[i][j] - 1 for j in range(W)]) for i in range(H)])
print(res)

-L = [] +S = [[0] * W for _ in range(H)] -    S = list(eval(input())) -    L.append(S) -ans1 = [[0 for i in range(W)] for j in range(H)] -ans2 = [[0 for i in range(W)] for j in range(H)] +    Si = list(eval(input())) +    for j in range(W): +        if Si[j] == "#": +            S[i][j] = 1 +# row +S_row = [[0] * W for _ in range(H)] -    val = 0 -    l = [] +    c = 0 -        if L[i][j] == "#": -            for k in l: -                ans1[i][k] = val -            val = 0 -            l = [] +        if S[i][j] == 1: +            c = 0 -            val += 1 -            l.append(j) -    for k in l: -        ans1[i][k] = val -for i in range(W): -    val = 0 -    l = [] -    for j in range(H): -        if L[j][i] == "#": -            for k in l: -                ans2[k][i] = val -            val = 0 -            l = [] +            c += 1 +        S_row[i][j] = c +    # reverse +    for j in range(W - 2, -1, -1): +        if S_row[i][j + 1] > 0 and S_row[i][j] > 0: +            S_row[i][j] = S_row[i][j + 1] +# col +S_col = [[0] * W for _ in range(H)] +for j in range(W): +    c = 0 +    for i in range(H): +        if S[i][j] == 1: +            c = 0 -            val += 1 -            l.append(j) -    for k in l: -        ans2[k][i] = val -ans = -1 -for i in range(H): -    for j in range(W): -        x = ans1[i][j] + ans2[i][j] - 1 -        if x > ans: -            ans = x -print(ans) +            c += 1 +        S_col[i][j] = c +    # reverse +    for i in range(H - 2, -1, -1): +        if S_col[i + 1][j] > 0 and S_col[i][j] > 0: +            S_col[i][j] = S_col[i + 1][j] +# res +res = max([max([S_row[i][j] + S_col[i][j] - 1 for j in range(W)]) for i in range(H)]) +print(res)