h, w = list(map(int, input().split()))

s = []

for _ in range(h):

    s.append(eval(input()))

lis_row = [[0 for j in range(w)] for i in range(h)]

lis_column = [[0 for j in range(w)] for i in range(h)]

for i in range(h):

    tmp = 0

    lis = []

    for j in range(w):

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

            lis.append(0)

            tmp = 0

        else:

            tmp += 1

            lis.append(tmp)

    now = 0

    for j in range(w-1, -1, -1):

        if lis[j] != 0:

            now = max(lis[j], now)

            lis_row[i][j] = now

        else:

            now = 0



for j in range(w):

    tmp = 0

    lis = []

    for i in range(h):

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

            lis.append(0)

            tmp = 0

        else:

            tmp += 1

            lis.append(tmp)

    now = 0

    for i in range(h-1, -1, -1):

        if lis[i] != 0:

            now = max(lis[i], now)

            lis_column[i][j] = now

        else:

            now = 0

ans = 0

for i in range(h):

    for j in range(w):

        if s[i][j] == ".":

            ans = max(ans, lis_row[i][j] + lis_column[i][j] -1)

print(ans)
h, w = list(map(int, input().split()))

s = []

for i in range(h):

    s.append(eval(input()))

ans = [[0 for j in range(w)] for i in range(h)]

for i in range(h):

    done = [False] * w

    for j in range(w):

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

            continue

        if done[j]:

            continue

        l = 0

        while j+l < w:

            if s[i][j+l] == "#":

                break

            l += 1

        for k in range(j, j+l):

            ans[i][k] += l

            done[k] = True

for j in range(w):

    done = [False] * h

    for i in range(h):

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

            continue

        if done[i]:

            continue

        l = 0

        while i+l < h:

            if s[i+l][j] == "#":

                break

            l += 1

        for k in range(i, i+l):

            ans[k][j] += l

            done[k] = True

res = 0

for i in range(h):

    res = max(max(ans[i]), res)

res -= 1

print(res)
h, w = list(map(int, input().split()))
s = []
for _ in range(h):
    s.append(eval(input()))
lis_row = [[0 for j in range(w)] for i in range(h)]
lis_column = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
    tmp = 0
    lis = []
    for j in range(w):
        if s[i][j] == "#":
            lis.append(0)
            tmp = 0
        else:
            tmp += 1
            lis.append(tmp)
    now = 0
    for j in range(w - 1, -1, -1):
        if lis[j] != 0:
            now = max(lis[j], now)
            lis_row[i][j] = now
        else:
            now = 0
for j in range(w):
    tmp = 0
    lis = []
    for i in range(h):
        if s[i][j] == "#":
            lis.append(0)
            tmp = 0
        else:
            tmp += 1
            lis.append(tmp)
    now = 0
    for i in range(h - 1, -1, -1):
        if lis[i] != 0:
            now = max(lis[i], now)
            lis_column[i][j] = now
        else:
            now = 0
ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            ans = max(ans, lis_row[i][j] + lis_column[i][j] - 1)
print(ans)

h, w = list(map(int, input().split()))
s = []
for i in range(h):
    s.append(eval(input()))
ans = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
    done = [False] * w
    for j in range(w):
        if s[i][j] == "#":
            continue
        if done[j]:
            continue
        l = 0
        while j + l < w:
            if s[i][j + l] == "#":
                break
            l += 1
        for k in range(j, j + l):
            ans[i][k] += l
            done[k] = True
for j in range(w):
    done = [False] * h
    for i in range(h):
        if s[i][j] == "#":
            continue
        if done[i]:
            continue
        l = 0
        while i + l < h:
            if s[i + l][j] == "#":
                break
            l += 1
        for k in range(i, i + l):
            ans[k][j] += l
            done[k] = True
res = 0
for i in range(h):
    res = max(max(ans[i]), res)
res -= 1
print(res)

-for _ in range(h): +for i in range(h): -lis_row = [[0 for j in range(w)] for i in range(h)] -lis_column = [[0 for j in range(w)] for i in range(h)] +ans = [[0 for j in range(w)] for i in range(h)] -    tmp = 0 -    lis = [] +    done = [False] * w -            lis.append(0) -            tmp = 0 -        else: -            tmp += 1 -            lis.append(tmp) -    now = 0 -    for j in range(w - 1, -1, -1): -        if lis[j] != 0: -            now = max(lis[j], now) -            lis_row[i][j] = now -        else: -            now = 0 +            continue +        if done[j]: +            continue +        l = 0 +        while j + l < w: +            if s[i][j + l] == "#": +                break +            l += 1 +        for k in range(j, j + l): +            ans[i][k] += l +            done[k] = True -    tmp = 0 -    lis = [] +    done = [False] * h -            lis.append(0) -            tmp = 0 -        else: -            tmp += 1 -            lis.append(tmp) -    now = 0 -    for i in range(h - 1, -1, -1): -        if lis[i] != 0: -            now = max(lis[i], now) -            lis_column[i][j] = now -        else: -            now = 0 -ans = 0 +            continue +        if done[i]: +            continue +        l = 0 +        while i + l < h: +            if s[i + l][j] == "#": +                break +            l += 1 +        for k in range(i, i + l): +            ans[k][j] += l +            done[k] = True +res = 0 -    for j in range(w): -        if s[i][j] == ".": -            ans = max(ans, lis_row[i][j] + lis_column[i][j] - 1) -print(ans) +    res = max(max(ans[i]), res) +res -= 1 +print(res)