import numpy as np

H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]
S = np.array(S)
S = (S == '.') * 1

R = np.array([[0 for i in range(W)] for n in range(H)])
L = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1]
for i in range(H):
    if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1]

print(np.max(R + L + U + D) - 3) import numpy as np numpy H, W = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W list(input()) for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) list(input()) list input() input S = [list(input()) for _ in range(H)] S [list(input()) for _ in range(H)] S = np.array(S) S np.array(S) np.array np array S S = (S == '.') * 1 S (S == '.') * 1 S == '.' S '.' 1 [0 for i in range(W)] for n in range(H) for n in range(H) n range(H) range H for n in range(H) [0 for i in range(W)] R = np.array([[0 for i in range(W)] for n in range(H)]) R np.array([[0 for i in range(W)] for n in range(H)]) np.array np array [[0 for i in range(W)] for n in range(H)] L = np.zeros((H, W), dtype=int) L np.zeros((H, W), dtype=int) np.zeros np zeros (H, W) H W dtype=int dtype int U = np.zeros((H, W), dtype=int) U np.zeros((H, W), dtype=int) np.zeros np zeros (H, W) H W dtype=int dtype int D = np.zeros((H, W), dtype=int) D np.zeros((H, W), dtype=int) np.zeros np zeros (H, W) H W dtype=int dtype int for i in range(W):
    if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1] i range(W) range W if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1] i == 0 i 0 L[:, 0] = S[:, 0] L[:, 0] L : S[:, 0] S : R[:, W - 1] = S[:, W - 1] R[:, W - 1] R : S[:, W - 1] S : L[:, i] = L[:, i - 1] * S[:, i] + S[:, i] L[:, i] L : L[:, i - 1] * S[:, i] + S[:, i] L[:, i - 1] * S[:, i] L[:, i - 1] L : S[:, i] S : S[:, i] S : R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1] R[:, W - i - 1] R : R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1] R[:, W - i] * S[:, W - i - 1] R[:, W - i] R : S[:, W - i - 1] S : S[:, W - i - 1] S : for i in range(H):
    if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1] i range(H) range H if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1] i == 0 i 0 U[i] = S[i] U[i] U i S[i] S i D[H - 1] = S[H - 1] D[H - 1] D H - 1 H 1 S[H - 1] S H - 1 H 1 U[i] = U[i - 1] * S[i] + S[i] U[i] U i U[i - 1] * S[i] + S[i] U[i - 1] * S[i] U[i - 1] U i - 1 i 1 S[i] S i S[i] S i D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1] D[H - i - 1] D H - i - 1 H - i H i 1 D[H - i] * S[H - i - 1] + S[H - i - 1] D[H - i] * S[H - i - 1] D[H - i] D H - i H i S[H - i - 1] S H - i - 1 H - i H i 1 S[H - i - 1] S H - i - 1 H - i H i 1 print(np.max(R + L + U + D) - 3) print np.max(R + L + U + D) - 3 np.max(R + L + U + D) np.max np max R + L + U + D R + L + U R + L R L U D 3 S = [list(input()) for _ in range(H)] [list(input()) for _ in range(H)] S R = np.array([[0 for i in range(W)] for n in range(H)]) np.array([[0 for i in range(W)] for n in range(H)]) R W = map(int,input().split()) map(int,input().split()) W D = np.zeros((H, W), dtype=int) np.zeros((H, W), dtype=int) D H, W = map(int,input().split()) map(int,input().split()) H S = np.array(S) np.array(S) S S = (S == '.') * 1 (S == '.') * 1 S L = np.zeros((H, W), dtype=int) np.zeros((H, W), dtype=int) L U = np.zeros((H, W), dtype=int) np.zeros((H, W), dtype=int) U
import numpy as np

H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]
S = np.array(S)
S = (S == '.') * 1

R = np.array([[0 for i in range(W)] for n in range(H)])
L = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1]
for i in range(H):
    if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1]

print(np.max(R + L + U + D) - 3)