import sys
sys.setrecursionlimit(10**6)
H,W = map(int,input().split())
grid = []
for _ in range(H):
  grid.append(list(input()))

L = [ [0]*W for _ in range(H) ]
R = [ [0]*W for _ in range(H) ]
U = [ [0]*W for _ in range(H) ]
D = [ [0]*W for _ in range(H) ]

for i in range(H):
  for j in range(W):
    if j-1 >= 0:
      L[i][j] = L[i][j-1]
    if i-1 >= 0:
      D[i][j] = D[i-1][j]

    if grid[i][j] == ".":
      L[i][j] += 1
      D[i][j] += 1
    else:
      L[i][j] = 0
      D[i][j] = 0

for i in range(H-1,-1,-1):
  for j in range(W-1,-1,-1):
    if j+1 < W:
      R[i][j] = R[i][j+1] 
    if i+1 < H:
      U[i][j] = U[i+1][j]
    if grid[i][j] == ".":
      R[i][j] += 1
      U[i][j] += 1
    else:
      R[i][j] = 0
      U[i][j] = 0

res = 0
for i in range(H):
  for j in range(W):
    if grid[i][j] == ".":
      res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(res) import sys sys sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 H,W = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W grid = [] grid [] for _ in range(H):
  grid.append(list(input())) _ range(H) range H grid.append(list(input())) grid.append grid append list(input()) list input() input [0]*W for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0]*W [0] 0 W L = [ [0]*W for _ in range(H) ] L [ [0]*W 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 R = [ [0]*W for _ in range(H) ] R [ [0]*W 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 U = [ [0]*W for _ in range(H) ] U [ [0]*W 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 D = [ [0]*W for _ in range(H) ] D [ [0]*W for _ in range(H) ] for i in range(H):
  for j in range(W):
    if j-1 >= 0:
      L[i][j] = L[i][j-1]
    if i-1 >= 0:
      D[i][j] = D[i-1][j]

    if grid[i][j] == ".":
      L[i][j] += 1
      D[i][j] += 1
    else:
      L[i][j] = 0
      D[i][j] = 0 i range(H) range H for j in range(W):
    if j-1 >= 0:
      L[i][j] = L[i][j-1]
    if i-1 >= 0:
      D[i][j] = D[i-1][j]

    if grid[i][j] == ".":
      L[i][j] += 1
      D[i][j] += 1
    else:
      L[i][j] = 0
      D[i][j] = 0 j range(W) range W if j-1 >= 0:
      L[i][j] = L[i][j-1]
     j-1 >= 0 j-1 j 1 0 L[i][j] = L[i][j-1] L[i][j] [i] L i j L[i][j-1] [i] L i j-1 j 1 if i-1 >= 0:
      D[i][j] = D[i-1][j]

     i-1 >= 0 i-1 i 1 0 D[i][j] = D[i-1][j] D[i][j] [i] D i j D[i-1][j] [i-1] D i-1 i 1 j if grid[i][j] == ".":
      L[i][j] += 1
      D[i][j] += 1
    else:
      L[i][j] = 0
      D[i][j] = 0 grid[i][j] == "." grid[i][j] [i] grid i j "." L[i][j] += 1 L[i][j] [i] L i j 1 D[i][j] += 1 D[i][j] [i] D i j 1 L[i][j] = 0 L[i][j] [i] L i j 0 D[i][j] = 0 D[i][j] [i] D i j 0 for i in range(H-1,-1,-1):
  for j in range(W-1,-1,-1):
    if j+1 < W:
      R[i][j] = R[i][j+1] 
    if i+1 < H:
      U[i][j] = U[i+1][j]
    if grid[i][j] == ".":
      R[i][j] += 1
      U[i][j] += 1
    else:
      R[i][j] = 0
      U[i][j] = 0 i range(H-1,-1,-1) range H-1 H 1 -1 -1 for j in range(W-1,-1,-1):
    if j+1 < W:
      R[i][j] = R[i][j+1] 
    if i+1 < H:
      U[i][j] = U[i+1][j]
    if grid[i][j] == ".":
      R[i][j] += 1
      U[i][j] += 1
    else:
      R[i][j] = 0
      U[i][j] = 0 j range(W-1,-1,-1) range W-1 W 1 -1 -1 if j+1 < W:
      R[i][j] = R[i][j+1] 
     j+1 < W j+1 j 1 W R[i][j] = R[i][j+1] R[i][j] [i] R i j R[i][j+1] [i] R i j+1 j 1 if i+1 < H:
      U[i][j] = U[i+1][j]
     i+1 < H i+1 i 1 H U[i][j] = U[i+1][j] U[i][j] [i] U i j U[i+1][j] [i+1] U i+1 i 1 j if grid[i][j] == ".":
      R[i][j] += 1
      U[i][j] += 1
    else:
      R[i][j] = 0
      U[i][j] = 0 grid[i][j] == "." grid[i][j] [i] grid i j "." R[i][j] += 1 R[i][j] [i] R i j 1 U[i][j] += 1 U[i][j] [i] U i j 1 R[i][j] = 0 R[i][j] [i] R i j 0 U[i][j] = 0 U[i][j] [i] U i j 0 res = 0 res 0 for i in range(H):
  for j in range(W):
    if grid[i][j] == ".":
      res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3) i range(H) range H for j in range(W):
    if grid[i][j] == ".":
      res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3) j range(W) range W if grid[i][j] == ".":
      res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3) grid[i][j] == "." grid[i][j] [i] grid i j "." res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3) res max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3) max res L[i][j]+R[i][j]+U[i][j]+D[i][j]-3 L[i][j]+R[i][j]+U[i][j]+D[i][j] L[i][j]+R[i][j]+U[i][j] L[i][j]+R[i][j] L[i][j] [i] L i j R[i][j] [i] R i j U[i][j] [i] U i j D[i][j] [i] D i j 3 print(res) print res U = [ [0]*W for _ in range(H) ] [ [0]*W for _ in range(H) ] U R = [ [0]*W for _ in range(H) ] [ [0]*W for _ in range(H) ] R D = [ [0]*W for _ in range(H) ] [ [0]*W for _ in range(H) ] D L = [ [0]*W for _ in range(H) ] [ [0]*W for _ in range(H) ] L grid = [] [] grid W = map(int,input().split()) map(int,input().split()) W H,W = map(int,input().split()) map(int,input().split()) H res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3) max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3) res res = 0 0 res
import sys
sys.setrecursionlimit(10**6)
H,W = map(int,input().split())
grid = []
for _ in range(H):
  grid.append(list(input()))

L = [ [0]*W for _ in range(H) ]
R = [ [0]*W for _ in range(H) ]
U = [ [0]*W for _ in range(H) ]
D = [ [0]*W for _ in range(H) ]

for i in range(H):
  for j in range(W):
    if j-1 >= 0:
      L[i][j] = L[i][j-1]
    if i-1 >= 0:
      D[i][j] = D[i-1][j]

    if grid[i][j] == ".":
      L[i][j] += 1
      D[i][j] += 1
    else:
      L[i][j] = 0
      D[i][j] = 0

for i in range(H-1,-1,-1):
  for j in range(W-1,-1,-1):
    if j+1 < W:
      R[i][j] = R[i][j+1] 
    if i+1 < H:
      U[i][j] = U[i+1][j]
    if grid[i][j] == ".":
      R[i][j] += 1
      U[i][j] += 1
    else:
      R[i][j] = 0
      U[i][j] = 0

res = 0
for i in range(H):
  for j in range(W):
    if grid[i][j] == ".":
      res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(res)