from itertools import chain
H, W = map(int, input().split())
S = [input()+"#" for _ in range(H)]
S.append("#"*(W+1))
A = [[0]*(W) for _ in range(H)]

for i in range(H):
    tmp = 0
    stack = []
    for j in range(W+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(j)
        # elif j == W-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(j)
            
        #     while stack:
        #         tmp_j = stack.pop()
        #         A[i][tmp_j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_j = stack.pop()
                A[i][tmp_j] += tmp
            tmp = 0
for j in range(W):
    tmp = 0
    stack = []
    for i in range(H+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(i)
        # elif i == H-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(i)
        #     while stack:
        #         tmp_i = stack.pop()
        #         A[tmp_i][j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_i = stack.pop()
                A[tmp_i][j] += tmp
            tmp = 0
ans = max(chain.from_iterable(A))-1
print(ans) from itertools import chain H, W = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W input()+"#" for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) input()+"#" input() input "#" S = [input()+"#" for _ in range(H)] S [input()+"#" for _ in range(H)] S.append("#"*(W+1)) S.append S append "#"*(W+1) "#" W+1 W 1 [0]*(W) for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0]*(W) [0] 0 W A = [[0]*(W) for _ in range(H)] A [[0]*(W) for _ in range(H)] for i in range(H):
    tmp = 0
    stack = []
    for j in range(W+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(j)
        # elif j == W-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(j)
            
        #     while stack:
        #         tmp_j = stack.pop()
        #         A[i][tmp_j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_j = stack.pop()
                A[i][tmp_j] += tmp
            tmp = 0 i range(H) range H tmp = 0 tmp 0 stack = [] stack [] for j in range(W+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(j)
        # elif j == W-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(j)
            
        #     while stack:
        #         tmp_j = stack.pop()
        #         A[i][tmp_j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_j = stack.pop()
                A[i][tmp_j] += tmp
            tmp = 0 j range(W+1) range W+1 W 1 if S[i][j] == ".":
            tmp += 1
            stack.append(j)
        # elif j == W-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(j)
            
        #     while stack:
        #         tmp_j = stack.pop()
        #         A[i][tmp_j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_j = stack.pop()
                A[i][tmp_j] += tmp
            tmp = 0 S[i][j] == "." S[i][j] [i] S i j "." tmp += 1 tmp 1 stack.append(j) stack.append stack append j while stack:
                tmp_j = stack.pop()
                A[i][tmp_j] += tmp
             stack tmp_j = stack.pop() tmp_j stack.pop() stack.pop stack pop A[i][tmp_j] += tmp A[i][tmp_j] [i] A i tmp_j tmp tmp = 0 tmp 0 for j in range(W):
    tmp = 0
    stack = []
    for i in range(H+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(i)
        # elif i == H-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(i)
        #     while stack:
        #         tmp_i = stack.pop()
        #         A[tmp_i][j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_i = stack.pop()
                A[tmp_i][j] += tmp
            tmp = 0 j range(W) range W tmp = 0 tmp 0 stack = [] stack [] for i in range(H+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(i)
        # elif i == H-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(i)
        #     while stack:
        #         tmp_i = stack.pop()
        #         A[tmp_i][j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_i = stack.pop()
                A[tmp_i][j] += tmp
            tmp = 0 i range(H+1) range H+1 H 1 if S[i][j] == ".":
            tmp += 1
            stack.append(i)
        # elif i == H-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(i)
        #     while stack:
        #         tmp_i = stack.pop()
        #         A[tmp_i][j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_i = stack.pop()
                A[tmp_i][j] += tmp
            tmp = 0 S[i][j] == "." S[i][j] [i] S i j "." tmp += 1 tmp 1 stack.append(i) stack.append stack append i while stack:
                tmp_i = stack.pop()
                A[tmp_i][j] += tmp
             stack tmp_i = stack.pop() tmp_i stack.pop() stack.pop stack pop A[tmp_i][j] += tmp A[tmp_i][j] [tmp_i] A tmp_i j tmp tmp = 0 tmp 0 ans = max(chain.from_iterable(A))-1 ans max(chain.from_iterable(A))-1 max(chain.from_iterable(A)) max chain.from_iterable(A) chain.from_iterable chain from_iterable A 1 print(ans) print ans tmp += 1 1 tmp ans = max(chain.from_iterable(A))-1 max(chain.from_iterable(A))-1 ans tmp_i = stack.pop() stack.pop() tmp_i stack = [] [] stack tmp = 0 0 tmp H, W = map(int, input().split()) map(int, input().split()) H W = map(int, input().split()) map(int, input().split()) W tmp_j = stack.pop() stack.pop() tmp_j S = [input()+"#" for _ in range(H)] [input()+"#" for _ in range(H)] S tmp += 1 1 tmp tmp = 0 0 tmp tmp = 0 0 tmp A = [[0]*(W) for _ in range(H)] [[0]*(W) for _ in range(H)] A stack = [] [] stack tmp = 0 0 tmp
from itertools import chain
H, W = map(int, input().split())
S = [input()+"#" for _ in range(H)]
S.append("#"*(W+1))
A = [[0]*(W) for _ in range(H)]

for i in range(H):
    tmp = 0
    stack = []
    for j in range(W+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(j)
        # elif j == W-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(j)
            
        #     while stack:
        #         tmp_j = stack.pop()
        #         A[i][tmp_j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_j = stack.pop()
                A[i][tmp_j] += tmp
            tmp = 0
for j in range(W):
    tmp = 0
    stack = []
    for i in range(H+1):
        if S[i][j] == ".":
            tmp += 1
            stack.append(i)
        # elif i == H-1:
        #     if S[i][j] == ".":
        #         tmp += 1
        #         stack.append(i)
        #     while stack:
        #         tmp_i = stack.pop()
        #         A[tmp_i][j] += tmp
        #     tmp = 0
        else:
            while stack:
                tmp_i = stack.pop()
                A[tmp_i][j] += tmp
            tmp = 0
ans = max(chain.from_iterable(A))-1
print(ans)