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

grid = []

for i in range(H):

    grid.append(eval(input()))

horiz = [[None]*W for _ in range(H)]

horiv = [[] for _ in range(H)]

for i in range(H):

    cur = 0

    for j in range(W):

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

            horiz[i][j] = len(horiv[i])

        else:

            horiv[i].append(j - cur)

            cur = j + 1

    horiv[i].append(W-cur)



maxv = 0

for c in range(W):

    cur = 0

    besth = 0

    for r in range(H):

        if grid[r][c] == '.':

            besth = max(besth, horiv[r][horiz[r][c]])

        else:

            maxv = max(maxv, r-cur + besth - 1)

            cur = r+1

            besth = 0

    maxv = max(maxv, H-cur + besth - 1)



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

grid = []

for i in range(H):

    grid.append(eval(input()))

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

for i in range(H):

    cur = 0

    for j in range(W):

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

            for k in range(cur, j):

                horiz[i][k] = j-cur

            cur = j+1

    for k in range(cur, W):

        horiz[i][k] = W-cur



maxv = 0

for c in range(W):

    cur = 0

    besth = 0

    for r in range(H):

        if grid[r][c] == '.':

            besth = max(besth, horiz[r][c])

        else:

            maxv = max(maxv, r-cur + besth - 1)

            cur = r+1

            besth = 0

    maxv = max(maxv, H-cur + besth - 1)



print(maxv)
H, W = list(map(int, input().split()))
grid = []
for i in range(H):
    grid.append(eval(input()))
horiz = [[None] * W for _ in range(H)]
horiv = [[] for _ in range(H)]
for i in range(H):
    cur = 0
    for j in range(W):
        if grid[i][j] == ".":
            horiz[i][j] = len(horiv[i])
        else:
            horiv[i].append(j - cur)
            cur = j + 1
    horiv[i].append(W - cur)
maxv = 0
for c in range(W):
    cur = 0
    besth = 0
    for r in range(H):
        if grid[r][c] == ".":
            besth = max(besth, horiv[r][horiz[r][c]])
        else:
            maxv = max(maxv, r - cur + besth - 1)
            cur = r + 1
            besth = 0
    maxv = max(maxv, H - cur + besth - 1)
print(maxv)

H, W = list(map(int, input().split()))
grid = []
for i in range(H):
    grid.append(eval(input()))
horiz = [[0] * W for _ in range(H)]
for i in range(H):
    cur = 0
    for j in range(W):
        if grid[i][j] == "#":
            for k in range(cur, j):
                horiz[i][k] = j - cur
            cur = j + 1
    for k in range(cur, W):
        horiz[i][k] = W - cur
maxv = 0
for c in range(W):
    cur = 0
    besth = 0
    for r in range(H):
        if grid[r][c] == ".":
            besth = max(besth, horiz[r][c])
        else:
            maxv = max(maxv, r - cur + besth - 1)
            cur = r + 1
            besth = 0
    maxv = max(maxv, H - cur + besth - 1)
print(maxv)

-horiz = [[None] * W for _ in range(H)] -horiv = [[] for _ in range(H)] +horiz = [[0] * W for _ in range(H)] -        if grid[i][j] == ".": -            horiz[i][j] = len(horiv[i]) -        else: -            horiv[i].append(j - cur) +        if grid[i][j] == "#": +            for k in range(cur, j): +                horiz[i][k] = j - cur -    horiv[i].append(W - cur) +    for k in range(cur, W): +        horiz[i][k] = W - cur -            besth = max(besth, horiv[r][horiz[r][c]]) +            besth = max(besth, horiz[r][c])