#  D -Lamp

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

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

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

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

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

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



for i in range(h):

    if g[i][0]=='.':

        l[i][0]=1



for i in range(h):

    for j in range(w-1):

        if g[i][j+1]=='.':

            l[i][j+1]=l[i][j]+1

        elif g[i][j+1]=='#':

            l[i][j+1]=0



for i in range(h):

    if g[i][w-1]=='.':

        r[i][w-1]=1



for i in range(h):

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

        if g[i][j-1]=='.':

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

        elif g[i][j-1]=='#':

            r[i][j-1]=0



for i in range(w):

    if g[0][i]=='.':

        u[0][i]=1



for i in range(w):

    for j in range(h-1):

        if g[j+1][i]=='.':

            u[j+1][i]=u[j][i]+1

        elif g[j+1][i]=='#':

            u[j+1][i]=0



for i in range(w):

    if g[h-1][i]=='.':

        o[h-1][i]=1



for i in range(w):

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

        if g[j-1][i]=='.':

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

        elif g[j-1][i]=='#':

            o[j-1][i]=0



ans=0

for i in range(h):

    for j in range(w):

        ans=max(ans,l[i][j]+r[i][j]+u[i][j]+o[i][j]-3)



print(ans)

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

s=[]

s.append("#"*(w+2))

for i in range(h):

  s.append("#"+eval(input())+"#")

s.append("#"*(w+2))

r=[[0]*(w+2) for i in range(h+2)]

l=[[0]*(w+2) for i in range(h+2)]

d=[[0]*(w+2) for i in range(h+2)]

u=[[0]*(w+2) for i in range(h+2)]



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

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

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

      r[i][j]=0

    else:

      r[i][j]+=r[i][j+1]+1

# print(r)

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

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

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

      l[i][j]=0

    else:

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

# print(l)

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

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

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

      u[i][j]=0

    else:

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

# print(u)

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

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

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

      d[i][j]=0

    else:

      d[i][j]+=d[i+1][j]+1

# print(d)

ans=0

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

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

    ans=max(r[i][j]+l[i][j]+u[i][j]+d[i][j]-3,ans)

print(ans)
#  D -Lamp
h, w = list(map(int, input().split()))
g = [eval(input()) for i in range(h)]
l = [[0] * w for i in range(h)]
r = [[0] * w for i in range(h)]
u = [[0] * w for i in range(h)]
o = [[0] * w for i in range(h)]
for i in range(h):
    if g[i][0] == ".":
        l[i][0] = 1
for i in range(h):
    for j in range(w - 1):
        if g[i][j + 1] == ".":
            l[i][j + 1] = l[i][j] + 1
        elif g[i][j + 1] == "#":
            l[i][j + 1] = 0
for i in range(h):
    if g[i][w - 1] == ".":
        r[i][w - 1] = 1
for i in range(h):
    for j in range(w - 1, 0, -1):
        if g[i][j - 1] == ".":
            r[i][j - 1] = r[i][j] + 1
        elif g[i][j - 1] == "#":
            r[i][j - 1] = 0
for i in range(w):
    if g[0][i] == ".":
        u[0][i] = 1
for i in range(w):
    for j in range(h - 1):
        if g[j + 1][i] == ".":
            u[j + 1][i] = u[j][i] + 1
        elif g[j + 1][i] == "#":
            u[j + 1][i] = 0
for i in range(w):
    if g[h - 1][i] == ".":
        o[h - 1][i] = 1
for i in range(w):
    for j in range(h - 1, 0, -1):
        if g[j - 1][i] == ".":
            o[j - 1][i] = o[j][i] + 1
        elif g[j - 1][i] == "#":
            o[j - 1][i] = 0
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, l[i][j] + r[i][j] + u[i][j] + o[i][j] - 3)
print(ans)

h, w = list(map(int, input().split()))
s = []
s.append("#" * (w + 2))
for i in range(h):
    s.append("#" + eval(input()) + "#")
s.append("#" * (w + 2))
r = [[0] * (w + 2) for i in range(h + 2)]
l = [[0] * (w + 2) for i in range(h + 2)]
d = [[0] * (w + 2) for i in range(h + 2)]
u = [[0] * (w + 2) for i in range(h + 2)]
for i in range(1, h + 1):
    for j in range(w + 1, 0, -1):
        if s[i][j] == "#":
            r[i][j] = 0
        else:
            r[i][j] += r[i][j + 1] + 1
# print(r)
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == "#":
            l[i][j] = 0
        else:
            l[i][j] += l[i][j - 1] + 1
# print(l)
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == "#":
            u[i][j] = 0
        else:
            u[i][j] += u[i - 1][j] + 1
# print(u)
for i in range(h + 1, 0, -1):
    for j in range(1, w + 1):
        if s[i][j] == "#":
            d[i][j] = 0
        else:
            d[i][j] += d[i + 1][j] + 1
# print(d)
ans = 0
for i in range(1, h + 1):
    for j in range(1, w + 1):
        ans = max(r[i][j] + l[i][j] + u[i][j] + d[i][j] - 3, ans)
print(ans)

-#  D -Lamp -g = [eval(input()) for i in range(h)] -l = [[0] * w for i in range(h)] -r = [[0] * w for i in range(h)] -u = [[0] * w for i in range(h)] -o = [[0] * w for i in range(h)] +s = [] +s.append("#" * (w + 2)) -    if g[i][0] == ".": -        l[i][0] = 1 -for i in range(h): -    for j in range(w - 1): -        if g[i][j + 1] == ".": -            l[i][j + 1] = l[i][j] + 1 -        elif g[i][j + 1] == "#": -            l[i][j + 1] = 0 -for i in range(h): -    if g[i][w - 1] == ".": -        r[i][w - 1] = 1 -for i in range(h): -    for j in range(w - 1, 0, -1): -        if g[i][j - 1] == ".": -            r[i][j - 1] = r[i][j] + 1 -        elif g[i][j - 1] == "#": -            r[i][j - 1] = 0 -for i in range(w): -    if g[0][i] == ".": -        u[0][i] = 1 -for i in range(w): -    for j in range(h - 1): -        if g[j + 1][i] == ".": -            u[j + 1][i] = u[j][i] + 1 -        elif g[j + 1][i] == "#": -            u[j + 1][i] = 0 -for i in range(w): -    if g[h - 1][i] == ".": -        o[h - 1][i] = 1 -for i in range(w): -    for j in range(h - 1, 0, -1): -        if g[j - 1][i] == ".": -            o[j - 1][i] = o[j][i] + 1 -        elif g[j - 1][i] == "#": -            o[j - 1][i] = 0 +    s.append("#" + eval(input()) + "#") +s.append("#" * (w + 2)) +r = [[0] * (w + 2) for i in range(h + 2)] +l = [[0] * (w + 2) for i in range(h + 2)] +d = [[0] * (w + 2) for i in range(h + 2)] +u = [[0] * (w + 2) for i in range(h + 2)] +for i in range(1, h + 1): +    for j in range(w + 1, 0, -1): +        if s[i][j] == "#": +            r[i][j] = 0 +        else: +            r[i][j] += r[i][j + 1] + 1 +# print(r) +for i in range(1, h + 1): +    for j in range(1, w + 1): +        if s[i][j] == "#": +            l[i][j] = 0 +        else: +            l[i][j] += l[i][j - 1] + 1 +# print(l) +for i in range(1, h + 1): +    for j in range(1, w + 1): +        if s[i][j] == "#": +            u[i][j] = 0 +        else: +            u[i][j] += u[i - 1][j] + 1 +# print(u) +for i in range(h + 1, 0, -1): +    for j in range(1, w + 1): +        if s[i][j] == "#": +            d[i][j] = 0 +        else: +            d[i][j] += d[i + 1][j] + 1 +# print(d) -for i in range(h): -    for j in range(w): -        ans = max(ans, l[i][j] + r[i][j] + u[i][j] + o[i][j] - 3) +for i in range(1, h + 1): +    for j in range(1, w + 1): +        ans = max(r[i][j] + l[i][j] + u[i][j] + d[i][j] - 3, ans)