from collections import deque

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

s = [list(input()) for _ in range(h)]

yo = [[0] * w for _ in range(h)]
q = deque([])
c = 0

for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1
        
        if s[i][j] == "#" or j == w-1:
            while len(q) > 0:
                x, y = q.pop()
                yo[x][y] = c
            c = 0



m = 0

c = 0
for j in range(w):
    for i in range(h):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1

        if s[i][j] == "#" or i == h-1:
            while len(q) > 0:
                x, y = q.pop()
                m = max(m, yo[x][y] + c - 1)
            c = 0
print(m) from collections import deque h, w = list(map(int, input().split())) h list(map(int, input().split())) list 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)] [0] * w for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) [0] * w [0] 0 w yo = [[0] * w for _ in range(h)] yo [[0] * w for _ in range(h)] q = deque([]) q deque([]) deque [] c = 0 c 0 for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1
        
        if s[i][j] == "#" or j == w-1:
            while len(q) > 0:
                x, y = q.pop()
                yo[x][y] = c
            c = 0 i range(h) range h for j in range(w):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1
        
        if s[i][j] == "#" or j == w-1:
            while len(q) > 0:
                x, y = q.pop()
                yo[x][y] = c
            c = 0 j range(w) range w if s[i][j] == ".":
            q.append((i, j))
            c += 1
        
         s[i][j] == "." s[i][j] [i] s i j "." q.append((i, j)) q.append q append (i, j) i j c += 1 c 1 if s[i][j] == "#" or j == w-1:
            while len(q) > 0:
                x, y = q.pop()
                yo[x][y] = c
            c = 0 s[i][j] == "#" or j == w-1 s[i][j] == "#" s[i][j] [i] s i j "#" j == w-1 j w-1 w 1 while len(q) > 0:
                x, y = q.pop()
                yo[x][y] = c
             len(q) > 0 len(q) len q 0 x, y = q.pop() x q.pop() q.pop q pop y yo[x][y] = c yo[x][y] [x] yo x y c c = 0 c 0 m = 0 m 0 c = 0 c 0 for j in range(w):
    for i in range(h):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1

        if s[i][j] == "#" or i == h-1:
            while len(q) > 0:
                x, y = q.pop()
                m = max(m, yo[x][y] + c - 1)
            c = 0 j range(w) range w for i in range(h):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1

        if s[i][j] == "#" or i == h-1:
            while len(q) > 0:
                x, y = q.pop()
                m = max(m, yo[x][y] + c - 1)
            c = 0 i range(h) range h if s[i][j] == ".":
            q.append((i, j))
            c += 1

         s[i][j] == "." s[i][j] [i] s i j "." q.append((i, j)) q.append q append (i, j) i j c += 1 c 1 if s[i][j] == "#" or i == h-1:
            while len(q) > 0:
                x, y = q.pop()
                m = max(m, yo[x][y] + c - 1)
            c = 0 s[i][j] == "#" or i == h-1 s[i][j] == "#" s[i][j] [i] s i j "#" i == h-1 i h-1 h 1 while len(q) > 0:
                x, y = q.pop()
                m = max(m, yo[x][y] + c - 1)
             len(q) > 0 len(q) len q 0 x, y = q.pop() x q.pop() q.pop q pop y m = max(m, yo[x][y] + c - 1) m max(m, yo[x][y] + c - 1) max m yo[x][y] + c - 1 yo[x][y] + c yo[x][y] [x] yo x y c 1 c = 0 c 0 print(m) print m c += 1 1 c x, y = q.pop() q.pop() x m = max(m, yo[x][y] + c - 1) max(m, yo[x][y] + c - 1) m c = 0 0 c y = q.pop() q.pop() y c = 0 0 c y = q.pop() q.pop() y yo = [[0] * w for _ in range(h)] [[0] * w for _ in range(h)] yo c += 1 1 c c = 0 0 c h, w = list(map(int, input().split())) list(map(int, input().split())) h x, y = q.pop() q.pop() x m = 0 0 m s = [list(input()) for _ in range(h)] [list(input()) for _ in range(h)] s c = 0 0 c w = list(map(int, input().split())) list(map(int, input().split())) w q = deque([]) deque([]) q
from collections import deque

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

s = [list(input()) for _ in range(h)]

yo = [[0] * w for _ in range(h)]
q = deque([])
c = 0

for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1
        
        if s[i][j] == "#" or j == w-1:
            while len(q) > 0:
                x, y = q.pop()
                yo[x][y] = c
            c = 0



m = 0

c = 0
for j in range(w):
    for i in range(h):
        if s[i][j] == ".":
            q.append((i, j))
            c += 1

        if s[i][j] == "#" or i == h-1:
            while len(q) > 0:
                x, y = q.pop()
                m = max(m, yo[x][y] + c - 1)
            c = 0
print(m)
