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

S = [list(eval(input())) for i in range(H)]

dpyoko = [[1]*(W) for i in range(H)]

for j in range(W):

    for i in range(H):

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

            dpyoko[i][j] = 0

        else:

            if j != 0:

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

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

    for i in range(H):

        if dpyoko[i][j] == 0:

            continue

        if j == W-1:

            continue

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

dptate = [[1]*(W) for i in range(H)]

for i in range(H):

    for j in range(W):

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

            dptate[i][j] = 0

        else:

            if i != 0:

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

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

    for j in range(W):

        if dptate[i][j] == 0:

            continue

        if i == H-1:

            continue

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

res = 0

for i in range(H):

    for j in range(W):

        res = max(res,dptate[i][j]+dpyoko[i][j]-1)

print(res)       

h,w = list(map(int,input().split()))

S = [eval(input()) for i in range(h)]

yoko = [[1]*w for _ in range(h)]

tate = [[1]*w for _ in range(h)]

for i in range(h):

    for j in range(w):

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

            yoko[i][j] = 0

        else:

            if j != 0:

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

for i in range(h):

    for j in range(w-1,-1,-1):

        if yoko[i][j] == 0:

            continue

        else:

            if j != w-1:

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

for j in range(w):

    for i in range(h):

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

            tate[i][j] = 0

        else:

            if i != 0:

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

for j in range(w):

    for i in range(h-1,-1,-1):

        if tate[i][j] == 0:

            continue

        else:

            if i != h-1:

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

res = 0

for i in range(h):

    for j in range(w):

        res = max(res,tate[i][j]+yoko[i][j]-1)

print(res)
H, W = list(map(int, input().split()))
S = [list(eval(input())) for i in range(H)]
dpyoko = [[1] * (W) for i in range(H)]
for j in range(W):
    for i in range(H):
        if S[i][j] == "#":
            dpyoko[i][j] = 0
        else:
            if j != 0:
                dpyoko[i][j] += dpyoko[i][j - 1]
for j in range(W - 1, -1, -1):
    for i in range(H):
        if dpyoko[i][j] == 0:
            continue
        if j == W - 1:
            continue
        dpyoko[i][j] = max(dpyoko[i][j], dpyoko[i][j + 1])
dptate = [[1] * (W) for i in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            dptate[i][j] = 0
        else:
            if i != 0:
                dptate[i][j] += dptate[i - 1][j]
for i in range(H - 1, -1, -1):
    for j in range(W):
        if dptate[i][j] == 0:
            continue
        if i == H - 1:
            continue
        dptate[i][j] = max(dptate[i][j], dptate[i + 1][j])
res = 0
for i in range(H):
    for j in range(W):
        res = max(res, dptate[i][j] + dpyoko[i][j] - 1)
print(res)

h, w = list(map(int, input().split()))
S = [eval(input()) for i in range(h)]
yoko = [[1] * w for _ in range(h)]
tate = [[1] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if S[i][j] == "#":
            yoko[i][j] = 0
        else:
            if j != 0:
                yoko[i][j] += yoko[i][j - 1]
for i in range(h):
    for j in range(w - 1, -1, -1):
        if yoko[i][j] == 0:
            continue
        else:
            if j != w - 1:
                yoko[i][j] = max(yoko[i][j], yoko[i][j + 1])
for j in range(w):
    for i in range(h):
        if S[i][j] == "#":
            tate[i][j] = 0
        else:
            if i != 0:
                tate[i][j] += tate[i - 1][j]
for j in range(w):
    for i in range(h - 1, -1, -1):
        if tate[i][j] == 0:
            continue
        else:
            if i != h - 1:
                tate[i][j] = max(tate[i][j], tate[i + 1][j])
res = 0
for i in range(h):
    for j in range(w):
        res = max(res, tate[i][j] + yoko[i][j] - 1)
print(res)

-H, W = list(map(int, input().split())) -S = [list(eval(input())) for i in range(H)] -dpyoko = [[1] * (W) for i in range(H)] -for j in range(W): -    for i in range(H): +h, w = list(map(int, input().split())) +S = [eval(input()) for i in range(h)] +yoko = [[1] * w for _ in range(h)] +tate = [[1] * w for _ in range(h)] +for i in range(h): +    for j in range(w): -            dpyoko[i][j] = 0 +            yoko[i][j] = 0 -                dpyoko[i][j] += dpyoko[i][j - 1] -for j in range(W - 1, -1, -1): -    for i in range(H): -        if dpyoko[i][j] == 0: +                yoko[i][j] += yoko[i][j - 1] +for i in range(h): +    for j in range(w - 1, -1, -1): +        if yoko[i][j] == 0: -        if j == W - 1: -            continue -        dpyoko[i][j] = max(dpyoko[i][j], dpyoko[i][j + 1]) -dptate = [[1] * (W) for i in range(H)] -for i in range(H): -    for j in range(W): +        else: +            if j != w - 1: +                yoko[i][j] = max(yoko[i][j], yoko[i][j + 1]) +for j in range(w): +    for i in range(h): -            dptate[i][j] = 0 +            tate[i][j] = 0 -                dptate[i][j] += dptate[i - 1][j] -for i in range(H - 1, -1, -1): -    for j in range(W): -        if dptate[i][j] == 0: +                tate[i][j] += tate[i - 1][j] +for j in range(w): +    for i in range(h - 1, -1, -1): +        if tate[i][j] == 0: -        if i == H - 1: -            continue -        dptate[i][j] = max(dptate[i][j], dptate[i + 1][j]) +        else: +            if i != h - 1: +                tate[i][j] = max(tate[i][j], tate[i + 1][j]) -for i in range(H): -    for j in range(W): -        res = max(res, dptate[i][j] + dpyoko[i][j] - 1) +for i in range(h): +    for j in range(w): +        res = max(res, tate[i][j] + yoko[i][j] - 1)