#lamp

import sys

input=sys.stdin.readline

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

lists=[]

for i in range(h):

    b=list(eval(input()))

    lists.append(b)

    

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

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

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

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



#rightの累積和

for i in range(h):

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

        if j==w-1:

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

                right[i][j]=0

            else:

                right[i][j]=1

        else:

            if lists[i][j+1]=="#":

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

                    right[i][j]=0

                else:

                    right[i][j]=1

            elif lists[i][j+1]==".":

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

                    right[i][j]=0

                else:

                    right[i][j]=right[i][j+1]+1





#leftの累積和

for i in range(h):

    for j in range(w):

        if j==0:

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

                left[i][j]=0

            else:

                left[i][j]=1

        else:

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

                left[i][j]=0

            else:

                left[i][j]=left[i][j-1]+1





#upの累積和

for i in range(w):

    for j in range(h):

        if j==0:

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

                up[j][i]=0

            else:

                up[j][i]=1

        else:

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

                up[j][i]=0

            else:

                up[j][i]=up[j-1][i]+1



                

#downの累積和

for i in range(w):

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

        if j==h-1:

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

                down[j][i]=0

            else:

                down[j][i]=1

        else:

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

                down[j][i]=0

            else:

                down[j][i]=down[j+1][i]+1

                

maxi=0

for i in range(h):

    for j in range(w):

        maxi=max(maxi,right[i][j]+left[i][j]+up[i][j]+down[i][j]-3)

print(maxi)           

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

lists=[]

for i in range(h):

    s=eval(input())

    lists.append(s)

ylists=[]

for some in lists:

    some=some+"#"

    cnt=0

    add=[]

    for i in range(w+1):

        if some[i]=="#":

            if cnt==0:

                add.append(0)

                cnt=0

            else:

                add.extend([cnt]*cnt)

                add.append(0)

                cnt=0

                

        elif some[i]!="#":

            cnt+=1

    del add[-1]

    ylists.append(add)

    



            

lists1=[]

for i in range(w):

    adds=""

    for j in range(h):

        adds+=lists[j][i]

    lists1.append(adds)

    

tlists=[]

for some in lists1:

    some=some+"#"

    cnt=0

    add=[]

    for i in range(h+1):

        if some[i]=="#":

            if cnt==0:

                add.append(0)

                cnt=0

            else:

                add.extend([cnt]*cnt)

                add.append(0)

                cnt=0

                

        elif some[i]!="#":

            cnt+=1

    del add[-1]

    tlists.append(add)





maximum=0

for i in range(h):

    for j in range(w):

        if ylists[i][j]==0 or tlists[j][i]==0:

            continue

        else:

            maximum=max(maximum,ylists[i][j]+tlists[j][i]-1)

print(maximum)    

# lamp
import sys

input = sys.stdin.readline
h, w = list(map(int, input().split()))
lists = []
for i in range(h):
    b = list(eval(input()))
    lists.append(b)
right = [[0 for i in range(w)] for j in range(h)]
left = [[0 for i in range(w)] for j in range(h)]
up = [[0 for i in range(w)] for j in range(h)]
down = [[0 for i in range(w)] for j in range(h)]
# rightの累積和
for i in range(h):
    for j in range(w - 1, -1, -1):
        if j == w - 1:
            if lists[i][j] == "#":
                right[i][j] = 0
            else:
                right[i][j] = 1
        else:
            if lists[i][j + 1] == "#":
                if lists[i][j] == "#":
                    right[i][j] = 0
                else:
                    right[i][j] = 1
            elif lists[i][j + 1] == ".":
                if lists[i][j] == "#":
                    right[i][j] = 0
                else:
                    right[i][j] = right[i][j + 1] + 1
# leftの累積和
for i in range(h):
    for j in range(w):
        if j == 0:
            if lists[i][j] == "#":
                left[i][j] = 0
            else:
                left[i][j] = 1
        else:
            if lists[i][j] == "#":
                left[i][j] = 0
            else:
                left[i][j] = left[i][j - 1] + 1
# upの累積和
for i in range(w):
    for j in range(h):
        if j == 0:
            if lists[j][i] == "#":
                up[j][i] = 0
            else:
                up[j][i] = 1
        else:
            if lists[j][i] == "#":
                up[j][i] = 0
            else:
                up[j][i] = up[j - 1][i] + 1
# downの累積和
for i in range(w):
    for j in range(h - 1, -1, -1):
        if j == h - 1:
            if lists[j][i] == "#":
                down[j][i] = 0
            else:
                down[j][i] = 1
        else:
            if lists[j][i] == "#":
                down[j][i] = 0
            else:
                down[j][i] = down[j + 1][i] + 1
maxi = 0
for i in range(h):
    for j in range(w):
        maxi = max(maxi, right[i][j] + left[i][j] + up[i][j] + down[i][j] - 3)
print(maxi)

h, w = list(map(int, input().split()))
lists = []
for i in range(h):
    s = eval(input())
    lists.append(s)
ylists = []
for some in lists:
    some = some + "#"
    cnt = 0
    add = []
    for i in range(w + 1):
        if some[i] == "#":
            if cnt == 0:
                add.append(0)
                cnt = 0
            else:
                add.extend([cnt] * cnt)
                add.append(0)
                cnt = 0
        elif some[i] != "#":
            cnt += 1
    del add[-1]
    ylists.append(add)
lists1 = []
for i in range(w):
    adds = ""
    for j in range(h):
        adds += lists[j][i]
    lists1.append(adds)
tlists = []
for some in lists1:
    some = some + "#"
    cnt = 0
    add = []
    for i in range(h + 1):
        if some[i] == "#":
            if cnt == 0:
                add.append(0)
                cnt = 0
            else:
                add.extend([cnt] * cnt)
                add.append(0)
                cnt = 0
        elif some[i] != "#":
            cnt += 1
    del add[-1]
    tlists.append(add)
maximum = 0
for i in range(h):
    for j in range(w):
        if ylists[i][j] == 0 or tlists[j][i] == 0:
            continue
        else:
            maximum = max(maximum, ylists[i][j] + tlists[j][i] - 1)
print(maximum)

-# lamp -import sys - -input = sys.stdin.readline -    b = list(eval(input())) -    lists.append(b) -right = [[0 for i in range(w)] for j in range(h)] -left = [[0 for i in range(w)] for j in range(h)] -up = [[0 for i in range(w)] for j in range(h)] -down = [[0 for i in range(w)] for j in range(h)] -# rightの累積和 -for i in range(h): -    for j in range(w - 1, -1, -1): -        if j == w - 1: -            if lists[i][j] == "#": -                right[i][j] = 0 +    s = eval(input()) +    lists.append(s) +ylists = [] +for some in lists: +    some = some + "#" +    cnt = 0 +    add = [] +    for i in range(w + 1): +        if some[i] == "#": +            if cnt == 0: +                add.append(0) +                cnt = 0 -                right[i][j] = 1 -        else: -            if lists[i][j + 1] == "#": -                if lists[i][j] == "#": -                    right[i][j] = 0 -                else: -                    right[i][j] = 1 -            elif lists[i][j + 1] == ".": -                if lists[i][j] == "#": -                    right[i][j] = 0 -                else: -                    right[i][j] = right[i][j + 1] + 1 -# leftの累積和 +                add.extend([cnt] * cnt) +                add.append(0) +                cnt = 0 +        elif some[i] != "#": +            cnt += 1 +    del add[-1] +    ylists.append(add) +lists1 = [] +for i in range(w): +    adds = "" +    for j in range(h): +        adds += lists[j][i] +    lists1.append(adds) +tlists = [] +for some in lists1: +    some = some + "#" +    cnt = 0 +    add = [] +    for i in range(h + 1): +        if some[i] == "#": +            if cnt == 0: +                add.append(0) +                cnt = 0 +            else: +                add.extend([cnt] * cnt) +                add.append(0) +                cnt = 0 +        elif some[i] != "#": +            cnt += 1 +    del add[-1] +    tlists.append(add) +maximum = 0 -        if j == 0: -            if lists[i][j] == "#": -                left[i][j] = 0 -            else: -                left[i][j] = 1 +        if ylists[i][j] == 0 or tlists[j][i] == 0: +            continue -            if lists[i][j] == "#": -                left[i][j] = 0 -            else: -                left[i][j] = left[i][j - 1] + 1 -# upの累積和 -for i in range(w): -    for j in range(h): -        if j == 0: -            if lists[j][i] == "#": -                up[j][i] = 0 -            else: -                up[j][i] = 1 -        else: -            if lists[j][i] == "#": -                up[j][i] = 0 -            else: -                up[j][i] = up[j - 1][i] + 1 -# downの累積和 -for i in range(w): -    for j in range(h - 1, -1, -1): -        if j == h - 1: -            if lists[j][i] == "#": -                down[j][i] = 0 -            else: -                down[j][i] = 1 -        else: -            if lists[j][i] == "#": -                down[j][i] = 0 -            else: -                down[j][i] = down[j + 1][i] + 1 -maxi = 0 -for i in range(h): -    for j in range(w): -        maxi = max(maxi, right[i][j] + left[i][j] + up[i][j] + down[i][j] - 3) -print(maxi) +            maximum = max(maximum, ylists[i][j] + tlists[j][i] - 1) +print(maximum)