import numpy as np

import sys

buf = sys.stdin.buffer



H, W = list(map(int, buf.readline().split()))

grid = np.zeros((H + 2, W + 2), np.int32)

grid[1:-1, 1:-1] = (np.array(list(map(list, buf.read().decode('utf-8').split()))).reshape(H, W) == '.') * 1

grid_v = grid.T



right = np.maximum.accumulate(np.where(grid < 1, np.arange(W + 2), 0), axis=1)

left = np.fliplr(np.minimum.accumulate(np.fliplr(np.where(grid < 1, np.arange(W + 2), 10 ** 10)).copy(), axis=1))

down = np.maximum.accumulate(np.where(grid_v < 1, np.arange(H + 2), 0), axis=1).T

up = np.fliplr(np.minimum.accumulate(np.fliplr(np.where(grid_v < 1, np.arange(H + 2), 10 ** 10)).copy(), axis=1)).T



print((np.max((left - right) + (up - down)) - 3))
import numpy as np

import sys

line = sys.stdin.readline



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

grid = np.zeros((H + 2, W + 2), np.int32)

grid[1:-1, 1:-1] = (np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == '.') * 1

left = np.zeros((H + 2, W + 2), np.int32)

right = np.zeros((H + 2, W + 2), np.int32)

up = np.zeros((H + 2, W + 2), np.int32)

down = np.zeros((H + 2, W + 2), np.int32)



# 下方向に照らせるマスの数（自分の場所含む）

down[H] = grid[H]

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

    down[i - 1] = (down[i] + 1) * grid[i - 1]



up[1] = grid[1]

for i in range(1, H):

    up[i + 1] = (up[i] + 1) * grid[i + 1]



right[:, W] = grid[:, W]

for i in range(W, 0, -1):

    right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1]



left[:, 1] = grid[:, 1]

for i in range(1, W):

    left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1]



answer = (left + right + up + down) * grid

print((np.max(answer) - 3))
import numpy as np
import sys

buf = sys.stdin.buffer
H, W = list(map(int, buf.readline().split()))
grid = np.zeros((H + 2, W + 2), np.int32)
grid[1:-1, 1:-1] = (
    np.array(list(map(list, buf.read().decode("utf-8").split()))).reshape(H, W) == "."
) * 1
grid_v = grid.T
right = np.maximum.accumulate(np.where(grid < 1, np.arange(W + 2), 0), axis=1)
left = np.fliplr(
    np.minimum.accumulate(
        np.fliplr(np.where(grid < 1, np.arange(W + 2), 10**10)).copy(), axis=1
    )
)
down = np.maximum.accumulate(np.where(grid_v < 1, np.arange(H + 2), 0), axis=1).T
up = np.fliplr(
    np.minimum.accumulate(
        np.fliplr(np.where(grid_v < 1, np.arange(H + 2), 10**10)).copy(), axis=1
    )
).T
print((np.max((left - right) + (up - down)) - 3))

import numpy as np
import sys

line = sys.stdin.readline
H, W = list(map(int, line().split()))
grid = np.zeros((H + 2, W + 2), np.int32)
grid[1:-1, 1:-1] = (
    np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == "."
) * 1
left = np.zeros((H + 2, W + 2), np.int32)
right = np.zeros((H + 2, W + 2), np.int32)
up = np.zeros((H + 2, W + 2), np.int32)
down = np.zeros((H + 2, W + 2), np.int32)
# 下方向に照らせるマスの数（自分の場所含む）
down[H] = grid[H]
for i in range(H, 0, -1):
    down[i - 1] = (down[i] + 1) * grid[i - 1]
up[1] = grid[1]
for i in range(1, H):
    up[i + 1] = (up[i] + 1) * grid[i + 1]
right[:, W] = grid[:, W]
for i in range(W, 0, -1):
    right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1]
left[:, 1] = grid[:, 1]
for i in range(1, W):
    left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1]
answer = (left + right + up + down) * grid
print((np.max(answer) - 3))

-buf = sys.stdin.buffer -H, W = list(map(int, buf.readline().split())) +line = sys.stdin.readline +H, W = list(map(int, line().split())) -    np.array(list(map(list, buf.read().decode("utf-8").split()))).reshape(H, W) == "." +    np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == "." -grid_v = grid.T -right = np.maximum.accumulate(np.where(grid < 1, np.arange(W + 2), 0), axis=1) -left = np.fliplr( -    np.minimum.accumulate( -        np.fliplr(np.where(grid < 1, np.arange(W + 2), 10**10)).copy(), axis=1 -    ) -) -down = np.maximum.accumulate(np.where(grid_v < 1, np.arange(H + 2), 0), axis=1).T -up = np.fliplr( -    np.minimum.accumulate( -        np.fliplr(np.where(grid_v < 1, np.arange(H + 2), 10**10)).copy(), axis=1 -    ) -).T -print((np.max((left - right) + (up - down)) - 3)) +left = np.zeros((H + 2, W + 2), np.int32) +right = np.zeros((H + 2, W + 2), np.int32) +up = np.zeros((H + 2, W + 2), np.int32) +down = np.zeros((H + 2, W + 2), np.int32) +# 下方向に照らせるマスの数（自分の場所含む） +down[H] = grid[H] +for i in range(H, 0, -1): +    down[i - 1] = (down[i] + 1) * grid[i - 1] +up[1] = grid[1] +for i in range(1, H): +    up[i + 1] = (up[i] + 1) * grid[i + 1] +right[:, W] = grid[:, W] +for i in range(W, 0, -1): +    right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1] +left[:, 1] = grid[:, 1] +for i in range(1, W): +    left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1] +answer = (left + right + up + down) * grid +print((np.max(answer) - 3))