H, W = list(map(int,input().split()))

S = [list(eval(input())) for _ in range(H)]

table = [[0 for _ in range(W)] for _ in range(H)]

def dfsW(n):

  global table

  l = -1

  r = -1

  i = 0

  while i < W:

    if S[n][i] == ".":

      if l == -1:

        l = i

      r = i

    else:

      if l != -1:

        for j in range(l, r + 1):

          table[n][j] += r - l + 1

      l = -1

      r = -1

    i += 1

  if l != -1:

    for j in range(l, r + 1):

      table[n][j] += r - l + 1





def dfsH(n):

  global table

  l = -1

  r = -1

  i = 0

  while i < H:

    if S[i][n] == ".":

      if l == -1:

        l = i

      r = i

    else:

      if l != -1:

        for j in range(l, r + 1):

          table[j][n] += r - l + 1

      l = -1

      r = -1

    i += 1

    

  if l != -1:

    for j in range(l, r + 1):

      table[j][n] += r - l + 1





for i in range(H):

  dfsW(i)

for i in range(W):

  dfsH(i)

print((max(list(map(max, table))) - 1))
import sys

input = sys.stdin.readline

H, W = list(map(int, input().split()))

S = [list(eval(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)
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
table = [[0 for _ in range(W)] for _ in range(H)]


def dfsW(n):
    global table
    l = -1
    r = -1
    i = 0
    while i < W:
        if S[n][i] == ".":
            if l == -1:
                l = i
            r = i
        else:
            if l != -1:
                for j in range(l, r + 1):
                    table[n][j] += r - l + 1
            l = -1
            r = -1
        i += 1
    if l != -1:
        for j in range(l, r + 1):
            table[n][j] += r - l + 1


def dfsH(n):
    global table
    l = -1
    r = -1
    i = 0
    while i < H:
        if S[i][n] == ".":
            if l == -1:
                l = i
            r = i
        else:
            if l != -1:
                for j in range(l, r + 1):
                    table[j][n] += r - l + 1
            l = -1
            r = -1
        i += 1
    if l != -1:
        for j in range(l, r + 1):
            table[j][n] += r - l + 1


for i in range(H):
    dfsW(i)
for i in range(W):
    dfsH(i)
print((max(list(map(max, table))) - 1))

import sys

input = sys.stdin.readline
H, W = list(map(int, input().split()))
S = [list(eval(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 + +input = sys.stdin.readline -S = [list(eval(input())) for _ in range(H)] -table = [[0 for _ in range(W)] for _ in range(H)] - - -def dfsW(n): -    global table -    l = -1 -    r = -1 -    i = 0 -    while i < W: -        if S[n][i] == ".": -            if l == -1: -                l = i -            r = i +S = [list(eval(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 -            if l != -1: -                for j in range(l, r + 1): -                    table[n][j] += r - l + 1 -            l = -1 -            r = -1 -        i += 1 -    if l != -1: -        for j in range(l, r + 1): -            table[n][j] += r - l + 1 - - -def dfsH(n): -    global table -    l = -1 -    r = -1 -    i = 0 -    while i < H: -        if S[i][n] == ".": -            if l == -1: -                l = i -            r = i +            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 -            if l != -1: -                for j in range(l, r + 1): -                    table[j][n] += r - l + 1 -            l = -1 -            r = -1 -        i += 1 -    if l != -1: -        for j in range(l, r + 1): -            table[j][n] += r - l + 1 - - +            c += 1 +    imosud[prev][i] += c +    for j in range(H): +        imosud[j + 1][i] += imosud[j][i] +res = 0 -    dfsW(i) -for i in range(W): -    dfsH(i) -print((max(list(map(max, table))) - 1)) +    for j in range(W): +        res = max(res, imoslr[i][j] + imosud[i][j] - 1) +print(res)