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

for i in range(H):
    tmp = 0
    stack = []
    for j in range(W):
        if S[i][j] == "." and j < W-1:
            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):
        if S[i][j] == "." and i < H-1:
            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 S = [input() for _ in range(H)] S [input() for _ in range(H)] [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):
        if S[i][j] == "." and j < W-1:
            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):
        if S[i][j] == "." and j < W-1:
            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) range W if S[i][j] == "." and j < W-1:
            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] == "." and j < W-1 S[i][j] == "." S[i][j] [i] S i j "." j < W-1 j W-1 W 1 tmp += 1 tmp 1 stack.append(j) stack.append 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
         j == W-1 j W-1 W 1 if S[i][j] == ".":
                tmp += 1
                stack.append(j)
            
             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 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):
        if S[i][j] == "." and i < H-1:
            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):
        if S[i][j] == "." and i < H-1:
            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) range H if S[i][j] == "." and i < H-1:
            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] == "." and i < H-1 S[i][j] == "." S[i][j] [i] S i j "." i < H-1 i H-1 H 1 tmp += 1 tmp 1 stack.append(i) stack.append 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
         i == H-1 i H-1 H 1 if S[i][j] == ".":
                tmp += 1
                stack.append(i)
             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 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 stack = [] [] stack tmp = 0 0 tmp tmp_i = stack.pop() stack.pop() tmp_i tmp = 0 0 tmp tmp += 1 1 tmp tmp += 1 1 tmp S = [input() for _ in range(H)] [input() for _ in range(H)] S tmp_j = stack.pop() stack.pop() tmp_j tmp = 0 0 tmp tmp_j = stack.pop() stack.pop() tmp_j tmp_i = stack.pop() stack.pop() tmp_i tmp = 0 0 tmp H, W = map(int, input().split()) map(int, input().split()) H ans = max(chain.from_iterable(A))-1 max(chain.from_iterable(A))-1 ans tmp = 0 0 tmp tmp = 0 0 tmp stack = [] [] stack tmp += 1 1 tmp tmp += 1 1 tmp W = map(int, input().split()) map(int, input().split()) W A = [[0]*(W) for _ in range(H)] [[0]*(W) for _ in range(H)] A
from itertools import chain
H, W = map(int, input().split())
S = [input() for _ in range(H)]
A = [[0]*(W) for _ in range(H)]

for i in range(H):
    tmp = 0
    stack = []
    for j in range(W):
        if S[i][j] == "." and j < W-1:
            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):
        if S[i][j] == "." and i < H-1:
            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)