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

grid = [eval(input()) for _ in range(H)]



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

for i in range(H):

    for j in range(W):

        if grid[i][j] == '.':

            if j != 0 and grid[i][j - 1] == '.':

                graph_1[i][j] = graph_1[i][j - 1] + 1

            else:

                graph_1[i][j] = 1



for i in range(H):

    for j in reversed(list(range(W - 1))):

        if grid[i][j + 1] == '.' and grid[i][j] == '.':

            graph_1[i][j] = graph_1[i][j + 1]



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

for j in range(W):

    for i in range(H):

        if grid[i][j] == '.':

            if i != 0 and grid[i - 1][j] == '.':

                graph_2[i][j] = graph_2[i - 1][j] + 1

            else:

                graph_2[i][j] = 1



for j in range(W):

    for i in reversed(list(range(H - 1))):

        if grid[i + 1][j] == '.' and grid[i][j] == '.':

            graph_2[i][j] = graph_2[i + 1][j]



ans = 0

for i in range(H):

    for j in range(W):

        ans = max(ans, graph_1[i][j] + graph_2[i][j] - 1)

        

print(ans)

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

X = [eval(input()) for _ in range(H)]



grid0 = [[0] * (W + 1) for _ in range(H + 1)]



# L -> R

for i in range(H):

    for j in range(W):

        if X[i][j] == ".":

            grid0[i + 1][j + 1] = grid0[i + 1][j] + 1

        

# L <- R

for i in range(H):

    for j in reversed(list(range(W))):

        if grid0[i + 1][j] > 0:

            grid0[i + 1][j] = max(grid0[i + 1][j], grid0[i + 1][j + 1])



grid1 = [[0] * (W + 1) for _ in range(H + 1)]

for i in range(H):

    for j in range(W):

        if X[i][j] == ".":

            grid1[i + 1][j + 1] = grid1[i][j + 1] + 1



for i in reversed(list(range(H))):

    for j in range(W):

        if grid1[i][j + 1] > 0:

            grid1[i][j + 1] = max(grid1[i][j + 1], grid1[i + 1][j + 1])



ans = 0

for i in range(H):

    for j in range(W):

        ans = max(ans, grid0[i + 1][j + 1] + grid1[i + 1][j + 1] - 1)

print(ans)

H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
graph_1 = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if grid[i][j] == ".":
            if j != 0 and grid[i][j - 1] == ".":
                graph_1[i][j] = graph_1[i][j - 1] + 1
            else:
                graph_1[i][j] = 1
for i in range(H):
    for j in reversed(list(range(W - 1))):
        if grid[i][j + 1] == "." and grid[i][j] == ".":
            graph_1[i][j] = graph_1[i][j + 1]
graph_2 = [[0] * W for _ in range(H)]
for j in range(W):
    for i in range(H):
        if grid[i][j] == ".":
            if i != 0 and grid[i - 1][j] == ".":
                graph_2[i][j] = graph_2[i - 1][j] + 1
            else:
                graph_2[i][j] = 1
for j in range(W):
    for i in reversed(list(range(H - 1))):
        if grid[i + 1][j] == "." and grid[i][j] == ".":
            graph_2[i][j] = graph_2[i + 1][j]
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, graph_1[i][j] + graph_2[i][j] - 1)
print(ans)

H, W = list(map(int, input().split()))
X = [eval(input()) for _ in range(H)]
grid0 = [[0] * (W + 1) for _ in range(H + 1)]
# L -> R
for i in range(H):
    for j in range(W):
        if X[i][j] == ".":
            grid0[i + 1][j + 1] = grid0[i + 1][j] + 1
# L <- R
for i in range(H):
    for j in reversed(list(range(W))):
        if grid0[i + 1][j] > 0:
            grid0[i + 1][j] = max(grid0[i + 1][j], grid0[i + 1][j + 1])
grid1 = [[0] * (W + 1) for _ in range(H + 1)]
for i in range(H):
    for j in range(W):
        if X[i][j] == ".":
            grid1[i + 1][j + 1] = grid1[i][j + 1] + 1
for i in reversed(list(range(H))):
    for j in range(W):
        if grid1[i][j + 1] > 0:
            grid1[i][j + 1] = max(grid1[i][j + 1], grid1[i + 1][j + 1])
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, grid0[i + 1][j + 1] + grid1[i + 1][j + 1] - 1)
print(ans)

-grid = [eval(input()) for _ in range(H)] -graph_1 = [[0] * W for _ in range(H)] +X = [eval(input()) for _ in range(H)] +grid0 = [[0] * (W + 1) for _ in range(H + 1)] +# L -> R -        if grid[i][j] == ".": -            if j != 0 and grid[i][j - 1] == ".": -                graph_1[i][j] = graph_1[i][j - 1] + 1 -            else: -                graph_1[i][j] = 1 +        if X[i][j] == ".": +            grid0[i + 1][j + 1] = grid0[i + 1][j] + 1 +# L <- R -    for j in reversed(list(range(W - 1))): -        if grid[i][j + 1] == "." and grid[i][j] == ".": -            graph_1[i][j] = graph_1[i][j + 1] -graph_2 = [[0] * W for _ in range(H)] -for j in range(W): -    for i in range(H): -        if grid[i][j] == ".": -            if i != 0 and grid[i - 1][j] == ".": -                graph_2[i][j] = graph_2[i - 1][j] + 1 -            else: -                graph_2[i][j] = 1 -for j in range(W): -    for i in reversed(list(range(H - 1))): -        if grid[i + 1][j] == "." and grid[i][j] == ".": -            graph_2[i][j] = graph_2[i + 1][j] +    for j in reversed(list(range(W))): +        if grid0[i + 1][j] > 0: +            grid0[i + 1][j] = max(grid0[i + 1][j], grid0[i + 1][j + 1]) +grid1 = [[0] * (W + 1) for _ in range(H + 1)] +for i in range(H): +    for j in range(W): +        if X[i][j] == ".": +            grid1[i + 1][j + 1] = grid1[i][j + 1] + 1 +for i in reversed(list(range(H))): +    for j in range(W): +        if grid1[i][j + 1] > 0: +            grid1[i][j + 1] = max(grid1[i][j + 1], grid1[i + 1][j + 1]) -        ans = max(ans, graph_1[i][j] + graph_2[i][j] - 1) +        ans = max(ans, grid0[i + 1][j + 1] + grid1[i + 1][j + 1] - 1)