import sys
input = sys.stdin.readline
H, W = map(int, input().split())
S = [list(input())[: -1] for _ in range(H)]

imoslr = [[0] * (W + 1) for _ in range(H)]
for i in range(H):
  c = 0
  prev = 0
  for j in range(W):
    if S[i][j] == "#":
      imoslr[i][j] -= c
      imoslr[i][prev] += c
      prev = j + 1
      c = 0
    else: c += 1
  imoslr[i][prev] += c
  for j in range(W): imoslr[i][j + 1] += imoslr[i][j]

imosud = [[0] * (W) for _ in range(H + 1)]
for i in range(W):
  c = 0
  prev = 0
  for j in range(H):
    if S[j][i] == "#":
      imosud[j][i] -= c
      imosud[prev][i] += c
      prev = j + 1
      c = 0
    else: c += 1
  imosud[prev][i] += c
  for j in range(H): imosud[j + 1][i] += imosud[j][i]

res = 0
for i in range(H):
  for j in range(W): res = max(res, imoslr[i][j] + imosud[i][j] - 1)
print(res) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline H, W = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W list(input())[: -1] for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) list(input())[: -1] (input()) list input() input : -1 -1 S = [list(input())[: -1] for _ in range(H)] S [list(input())[: -1] for _ in range(H)] [0] * (W + 1) for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0] * (W + 1) [0] 0 W + 1 W 1 imoslr = [[0] * (W + 1) for _ in range(H)] imoslr [[0] * (W + 1) for _ in range(H)] for i in range(H):
  c = 0
  prev = 0
  for j in range(W):
    if S[i][j] == "#":
      imoslr[i][j] -= c
      imoslr[i][prev] += c
      prev = j + 1
      c = 0
    else: c += 1
  imoslr[i][prev] += c
  for j in range(W): imoslr[i][j + 1] += imoslr[i][j] i range(H) range H c = 0 c 0 prev = 0 prev 0 for j in range(W):
    if S[i][j] == "#":
      imoslr[i][j] -= c
      imoslr[i][prev] += c
      prev = j + 1
      c = 0
    else: c += 1
   j range(W) range W if S[i][j] == "#":
      imoslr[i][j] -= c
      imoslr[i][prev] += c
      prev = j + 1
      c = 0
    else: c += 1
   S[i][j] == "#" S[i][j] [i] S i j "#" imoslr[i][j] -= c imoslr[i][j] [i] imoslr i j c imoslr[i][prev] += c imoslr[i][prev] [i] imoslr i prev c prev = j + 1 prev j + 1 j 1 c = 0 c 0 imoslr[i][prev] += c imoslr[i][prev] [i] imoslr i prev c for j in range(W): imoslr[i][j + 1] += imoslr[i][ j range(W) range W [0] * (W) for _ in range(H + 1) for _ in range(H + 1) _ range(H + 1) range H + 1 H 1 for _ in range(H + 1) [0] * (W) [0] 0 W imosud = [[0] * (W) for _ in range(H + 1)] imosud [[0] * (W) for _ in range(H + 1)] for i in range(W):
  c = 0
  prev = 0
  for j in range(H):
    if S[j][i] == "#":
      imosud[j][i] -= c
      imosud[prev][i] += c
      prev = j + 1
      c = 0
    else: c += 1
  imosud[prev][i] += c
  for j in range(H): imosud[j + 1][i] += imosud[j][i] i range(W) range W c = 0 c 0 prev = 0 prev 0 for j in range(H):
    if S[j][i] == "#":
      imosud[j][i] -= c
      imosud[prev][i] += c
      prev = j + 1
      c = 0
    else: c += 1
   j range(H) range H if S[j][i] == "#":
      imosud[j][i] -= c
      imosud[prev][i] += c
      prev = j + 1
      c = 0
    else: c += 1
   S[j][i] == "#" S[j][i] [j] S j i "#" imosud[j][i] -= c imosud[j][i] [j] imosud j i c imosud[prev][i] += c imosud[prev][i] [prev] imosud prev i c prev = j + 1 prev j + 1 j 1 c = 0 c 0 imosud[prev][i] += c imosud[prev][i] [prev] imosud prev i c for j in range(H): imosud[j + 1][i] += imosud[j][ j range(H) range H res = 0 res 0 for i in range(H):
  for j in range(W): res = max(res, imoslr[i][j] + imosud[i][j] - 1) i range(H) range H for j in range(W): res = max(res, imoslr[i][j] + imosud[i][j] -  j range(W) range W print(res) print res prev = j + 1 j + 1 prev prev = j + 1 j + 1 prev W = map(int, input().split()) map(int, input().split()) W input = sys.stdin.readline sys.stdin.readline input c = 0 0 c H, W = map(int, input().split()) map(int, input().split()) H prev = 0 0 prev imosud = [[0] * (W) for _ in range(H + 1)] [[0] * (W) for _ in range(H + 1)] imosud c = 0 0 c prev = 0 0 prev c = 0 0 c imoslr = [[0] * (W + 1) for _ in range(H)] [[0] * (W + 1) for _ in range(H)] imoslr S = [list(input())[: -1] for _ in range(H)] [list(input())[: -1] for _ in range(H)] S res = 0 0 res c = 0 0 c
import sys
input = sys.stdin.readline
H, W = map(int, input().split())
S = [list(input())[: -1] for _ in range(H)]

imoslr = [[0] * (W + 1) for _ in range(H)]
for i in range(H):
  c = 0
  prev = 0
  for j in range(W):
    if S[i][j] == "#":
      imoslr[i][j] -= c
      imoslr[i][prev] += c
      prev = j + 1
      c = 0
    else: c += 1
  imoslr[i][prev] += c
  for j in range(W): imoslr[i][j + 1] += imoslr[i][j]

imosud = [[0] * (W) for _ in range(H + 1)]
for i in range(W):
  c = 0
  prev = 0
  for j in range(H):
    if S[j][i] == "#":
      imosud[j][i] -= c
      imosud[prev][i] += c
      prev = j + 1
      c = 0
    else: c += 1
  imosud[prev][i] += c
  for j in range(H): imosud[j + 1][i] += imosud[j][i]

res = 0
for i in range(H):
  for j in range(W): res = max(res, imoslr[i][j] + imosud[i][j] - 1)
print(res)