

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

l = [list(eval(input())) for i in range(h)]



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

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

ans = 0

for i in range(h):

    for j in range(w):

        if c1[i][j] == 0:

            n = 0

            while i+n < h:

                if l[i+n][j] == ".":

                    n +=1

                else:

                    break

            for k in range(n):

                c1[i+k][j] = n

            

        if c2[i][j] == 0:

            n = 0

            while j+n < w:

                if l[i][j+n] == ".":

                    n +=1

                else:

                    break

            for k in range(n):

                c2[i][j+k] = n





        ans = max(ans,c1[i][j]+c2[i][j])

print((ans-1))


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

l = [list(eval(input())) for i in range(h)]



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

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

ans = 0

for i in range(h):

    for j in range(w):

        if c1[i][j] == 0:

            n = 0

            k = i

            while k < h:

                if l[k][j] == ".":

                    n +=1

                    k += 1

                else:

                    break

            for r in range(i,k):

                c1[r][j] = n

            

        if c2[i][j] == 0:

            n = 0

            k = j

            while k < w:

                if l[i][k] == ".":

                    n +=1

                    k += 1

                else:

                    break

            for r in range(j,k):

                c2[i][r] = n





        ans = max(ans,c1[i][j]+c2[i][j])

print((ans-1))
h, w = list(map(int, input().split()))
l = [list(eval(input())) for i in range(h)]
c1 = [[0 for i in range(w)] for i in range(h)]
c2 = [[0 for i in range(w)] for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if c1[i][j] == 0:
            n = 0
            while i + n < h:
                if l[i + n][j] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c1[i + k][j] = n
        if c2[i][j] == 0:
            n = 0
            while j + n < w:
                if l[i][j + n] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c2[i][j + k] = n
        ans = max(ans, c1[i][j] + c2[i][j])
print((ans - 1))

h, w = list(map(int, input().split()))
l = [list(eval(input())) for i in range(h)]
c1 = [[0 for i in range(w)] for i in range(h)]
c2 = [[0 for i in range(w)] for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if c1[i][j] == 0:
            n = 0
            k = i
            while k < h:
                if l[k][j] == ".":
                    n += 1
                    k += 1
                else:
                    break
            for r in range(i, k):
                c1[r][j] = n
        if c2[i][j] == 0:
            n = 0
            k = j
            while k < w:
                if l[i][k] == ".":
                    n += 1
                    k += 1
                else:
                    break
            for r in range(j, k):
                c2[i][r] = n
        ans = max(ans, c1[i][j] + c2[i][j])
print((ans - 1))

-            while i + n < h: -                if l[i + n][j] == ".": +            k = i +            while k < h: +                if l[k][j] == ".": +                    k += 1 -            for k in range(n): -                c1[i + k][j] = n +            for r in range(i, k): +                c1[r][j] = n -            while j + n < w: -                if l[i][j + n] == ".": +            k = j +            while k < w: +                if l[i][k] == ".": +                    k += 1 -            for k in range(n): -                c2[i][j + k] = n +            for r in range(j, k): +                c2[i][r] = n