def add(n, l):

    global dp

    t = 0

    for v in range(1, len(l)):

        y = l[v]

        x = l[v-1]

        while t != y:

            dp[n][t] += y - 1 - x

            t += 1

        t += 1



def add2(n, l):

    global dp2

    t = 0

    for v in range(1, len(l)):

        y = l[v]

        x = l[v-1]

        while t != y:

            dp2[n][t] += y - 1 - x

            t += 1

        t += 1





H,W = [int(_) for _ in input().split()]

s = []

b = []

c = []

for _ in range(H):

    s.append(eval(input()))

for i in range(H):

    a = []

    a.append(0)

    for j in range(W):

        if s[i][j] == '#':

            a.append(j+1)

    a.append(W+1)

    b.append(a)

for j in range(W):

    a = []

    a.append(0)

    for i in range(H):

        if s[i][j] == '#':

            a.append(i+1)

    a.append(H+1)

    c.append(a)

dp = [[0 for _ in range(W+2)] for _ in range(H+2)]

dp2 = [[0 for _ in range(H+2)] for _ in range(W+2)]

for i in range(len(b)):

    add(i+1, b[i])

for i in range(W+2):

    for j in range(H+2):

        dp2[i][j] = dp[j][i]

for i in range(len(c)):

    add2(i+1, c[i])

for i in range(H+2):

    for j in range(W+2):

        dp[i][j] = dp2[j][i]

ans = 0

for i in range(1, H+1):

    for j in range(1, W+1):

        ans = max(ans, dp[i][j])

print((ans-1))

def add(dp, n, l):

    t = 0

    for v in range(1, len(l)):

        y = l[v]

        x = l[v-1]

        while t != y:

            dp[n][t] += y - 1 - x

            t += 1

        t += 1





H,W = [int(_) for _ in input().split()]

s = []

b = []

c = []

for _ in range(H):

    s.append(eval(input()))

for i in range(H):

    a = []

    a.append(0)

    for j in range(W):

        if s[i][j] == '#':

            a.append(j+1)

    a.append(W+1)

    b.append(a)

for j in range(W):

    a = []

    a.append(0)

    for i in range(H):

        if s[i][j] == '#':

            a.append(i+1)

    a.append(H+1)

    c.append(a)

dp = [[0 for _ in range(W+2)] for _ in range(H+2)]

dp2 = [[0 for _ in range(H+2)] for _ in range(W+2)]

for i in range(len(b)):

    add(dp, i+1, b[i])

for i in range(W+2):

    for j in range(H+2):

        dp2[i][j] = dp[j][i]

for i in range(len(c)):

    add(dp2, i+1, c[i])

ans = 0

for i in range(1, W+1):

    for j in range(1, H+1):

        ans = max(ans, dp2[i][j])

print((ans-1))



def add(n, l):
    global dp
    t = 0
    for v in range(1, len(l)):
        y = l[v]
        x = l[v - 1]
        while t != y:
            dp[n][t] += y - 1 - x
            t += 1
        t += 1


def add2(n, l):
    global dp2
    t = 0
    for v in range(1, len(l)):
        y = l[v]
        x = l[v - 1]
        while t != y:
            dp2[n][t] += y - 1 - x
            t += 1
        t += 1


H, W = [int(_) for _ in input().split()]
s = []
b = []
c = []
for _ in range(H):
    s.append(eval(input()))
for i in range(H):
    a = []
    a.append(0)
    for j in range(W):
        if s[i][j] == "#":
            a.append(j + 1)
    a.append(W + 1)
    b.append(a)
for j in range(W):
    a = []
    a.append(0)
    for i in range(H):
        if s[i][j] == "#":
            a.append(i + 1)
    a.append(H + 1)
    c.append(a)
dp = [[0 for _ in range(W + 2)] for _ in range(H + 2)]
dp2 = [[0 for _ in range(H + 2)] for _ in range(W + 2)]
for i in range(len(b)):
    add(i + 1, b[i])
for i in range(W + 2):
    for j in range(H + 2):
        dp2[i][j] = dp[j][i]
for i in range(len(c)):
    add2(i + 1, c[i])
for i in range(H + 2):
    for j in range(W + 2):
        dp[i][j] = dp2[j][i]
ans = 0
for i in range(1, H + 1):
    for j in range(1, W + 1):
        ans = max(ans, dp[i][j])
print((ans - 1))

def add(dp, n, l):
    t = 0
    for v in range(1, len(l)):
        y = l[v]
        x = l[v - 1]
        while t != y:
            dp[n][t] += y - 1 - x
            t += 1
        t += 1


H, W = [int(_) for _ in input().split()]
s = []
b = []
c = []
for _ in range(H):
    s.append(eval(input()))
for i in range(H):
    a = []
    a.append(0)
    for j in range(W):
        if s[i][j] == "#":
            a.append(j + 1)
    a.append(W + 1)
    b.append(a)
for j in range(W):
    a = []
    a.append(0)
    for i in range(H):
        if s[i][j] == "#":
            a.append(i + 1)
    a.append(H + 1)
    c.append(a)
dp = [[0 for _ in range(W + 2)] for _ in range(H + 2)]
dp2 = [[0 for _ in range(H + 2)] for _ in range(W + 2)]
for i in range(len(b)):
    add(dp, i + 1, b[i])
for i in range(W + 2):
    for j in range(H + 2):
        dp2[i][j] = dp[j][i]
for i in range(len(c)):
    add(dp2, i + 1, c[i])
ans = 0
for i in range(1, W + 1):
    for j in range(1, H + 1):
        ans = max(ans, dp2[i][j])
print((ans - 1))

-def add(n, l): -    global dp +def add(dp, n, l): -            t += 1 -        t += 1 - - -def add2(n, l): -    global dp2 -    t = 0 -    for v in range(1, len(l)): -        y = l[v] -        x = l[v - 1] -        while t != y: -            dp2[n][t] += y - 1 - x -    add(i + 1, b[i]) +    add(dp, i + 1, b[i]) -    add2(i + 1, c[i]) -for i in range(H + 2): -    for j in range(W + 2): -        dp[i][j] = dp2[j][i] +    add(dp2, i + 1, c[i]) -for i in range(1, H + 1): -    for j in range(1, W + 1): -        ans = max(ans, dp[i][j]) +for i in range(1, W + 1): +    for j in range(1, H + 1): +        ans = max(ans, dp2[i][j])