H,W = map(int,input().split())
maze = []
for i in range(H):
  s = input()
  maze.append(s)
def distance(maze,H,W):
  wall = []
  for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

  wd = [[0]*W for _ in range(H)]
  for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

  return wd

wd = distance(maze,H,W)
maze = [list(x) for x in zip(*maze)]
hd = distance(maze,W,H)
max_dist = 1

for i in range(H):
  for j in range(W):
    max_dist = max(max_dist,wd[i][j] + hd[j][i]+1)
print(max_dist) H,W = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W maze = [] maze [] for i in range(H):
  s = input()
  maze.append(s) i range(H) range H s = input() s input() input maze.append(s) maze.append maze append s def distance(maze,H,W):
  wall = []
  for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

  wd = [[0]*W for _ in range(H)]
  for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

  return wd distance wall = [] wall [] for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

   i range(H) range H w = [-1] w [-1] -1 for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
     j range(W) range W if maze[i][j] == '#':
        w.append(j)
     maze[i][j] == '#' maze[i][j] [i] maze i j '#' w.append(j) w.append w append j w.append(W) w.append w append W wall.append(w) wall.append wall append w [0]*W for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0]*W [0] 0 W wd = [[0]*W for _ in range(H)] wd [[0]*W for _ in range(H)] for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

   i range(H) range H w1 = 0 w1 0 for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

   j range(W) range W if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
       maze[i][j] == '#' maze[i][j] [i] maze i j '#' w1 = min(w1+1,len(wall[i])-1) w1 min(w1+1,len(wall[i])-1) min w1+1 w1 1 len(wall[i])-1 len(wall[i]) len wall[i] wall i 1 continue wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1 wd[i][j] [i] wd i j j-wall[i][w1]-1+wall[i][w1+1]-j-1 j-wall[i][w1]-1+wall[i][w1+1]-j j-wall[i][w1]-1+wall[i][w1+1] j-wall[i][w1]-1 j-wall[i][w1] j wall[i][w1] [i] wall i w1 1 wall[i][w1+1] [i] wall i w1+1 w1 1 j 1 return wd wd maze maze H H W W wd = distance(maze,H,W) wd distance(maze,H,W) distance maze H W list(x) for x in zip(*maze) for x in zip(*maze) x zip(*maze) zip *maze maze for x in zip(*maze) list(x) list x maze = [list(x) for x in zip(*maze)] maze [list(x) for x in zip(*maze)] hd = distance(maze,W,H) hd distance(maze,W,H) distance maze W H max_dist = 1 max_dist 1 for i in range(H):
  for j in range(W):
    max_dist = max(max_dist,wd[i][j] + hd[j][i]+1) i range(H) range H for j in range(W):
    max_dist = max(max_dist,wd[i][j] + hd[j][i]+1) j range(W) range W max_dist = max(max_dist,wd[i][j] + hd[j][i]+1) max_dist max(max_dist,wd[i][j] + hd[j][i]+1) max max_dist wd[i][j] + hd[j][i]+1 wd[i][j] + hd[j][i] wd[i][j] [i] wd i j hd[j][i] [j] hd j i 1 print(max_dist) print max_dist max_dist = max(max_dist,wd[i][j] + hd[j][i]+1) max(max_dist,wd[i][j] + hd[j][i]+1) max_dist hd = distance(maze,W,H) distance(maze,W,H) hd max_dist = 1 1 max_dist s = input() input() s maze = [list(x) for x in zip(*maze)] [list(x) for x in zip(*maze)] maze maze = [] [] maze wd = distance(maze,H,W) distance(maze,H,W) wd H,W = map(int,input().split()) map(int,input().split()) H W = map(int,input().split()) map(int,input().split()) W def distance(maze,H,W):
  wall = []
  for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

  wd = [[0]*W for _ in range(H)]
  for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

  return wd def distance(maze,H,W):
  wall = []
  for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

  wd = [[0]*W for _ in range(H)]
  for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

  return wd distance
H,W = map(int,input().split())
maze = []
for i in range(H):
  s = input()
  maze.append(s)
def distance(maze,H,W):
  wall = []
  for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

  wd = [[0]*W for _ in range(H)]
  for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

  return wd

wd = distance(maze,H,W)
maze = [list(x) for x in zip(*maze)]
hd = distance(maze,W,H)
max_dist = 1

for i in range(H):
  for j in range(W):
    max_dist = max(max_dist,wd[i][j] + hd[j][i]+1)
print(max_dist)