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

f=lambda:[[0]*w for _ in range(h)]

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

l,r=f(),f()

for i in range(h):

  lc=rc=0

  for j in range(w):

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

    else: lc=0

    if g[i][-1-j]=='.': rc+=1; r[i][-1-j]=rc

    else: rc=0

d,u=f(),f()

for i in range(w):

  dc=uc=0

  for j in range(h):

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

    else: dc=0

    if g[-1-j][i]=='.': uc+=1; u[-1-j][i]=uc

    else: uc=0

print((max(l[i][j]+r[i][j]+d[i][j]+u[i][j]-3 for i in range(h) for j in range(w))))
h,w=list(map(int,input().split()))

g=[[c=='.'for c in eval(input())] for _ in range(h)]

a=[[-3]*w for _ in range(h)]

for i in range(h):

  l=r=0

  for j in range(w):

    l=-~l*g[i][j]; a[i][j]+=l

    r=-~r*g[i][-1-j]; a[i][-1-j]+=r

for i in range(w):

  d=u=0

  for j in range(h):

    d=-~d*g[j][i]; a[j][i]+=d

    u=-~u*g[-1-j][i]; a[-1-j][i]+=u

print((max(a[i][j] for i in range(h) for j in range(w))))
h, w = list(map(int, input().split()))
f = lambda: [[0] * w for _ in range(h)]
g = [eval(input()) for _ in range(h)]
l, r = f(), f()
for i in range(h):
    lc = rc = 0
    for j in range(w):
        if g[i][j] == ".":
            lc += 1
            l[i][j] = lc
        else:
            lc = 0
        if g[i][-1 - j] == ".":
            rc += 1
            r[i][-1 - j] = rc
        else:
            rc = 0
d, u = f(), f()
for i in range(w):
    dc = uc = 0
    for j in range(h):
        if g[j][i] == ".":
            dc += 1
            d[j][i] = dc
        else:
            dc = 0
        if g[-1 - j][i] == ".":
            uc += 1
            u[-1 - j][i] = uc
        else:
            uc = 0
print(
    (max(l[i][j] + r[i][j] + d[i][j] + u[i][j] - 3 for i in range(h) for j in range(w)))
)

h, w = list(map(int, input().split()))
g = [[c == "." for c in eval(input())] for _ in range(h)]
a = [[-3] * w for _ in range(h)]
for i in range(h):
    l = r = 0
    for j in range(w):
        l = -~l * g[i][j]
        a[i][j] += l
        r = -~r * g[i][-1 - j]
        a[i][-1 - j] += r
for i in range(w):
    d = u = 0
    for j in range(h):
        d = -~d * g[j][i]
        a[j][i] += d
        u = -~u * g[-1 - j][i]
        a[-1 - j][i] += u
print((max(a[i][j] for i in range(h) for j in range(w))))

-f = lambda: [[0] * w for _ in range(h)] -g = [eval(input()) for _ in range(h)] -l, r = f(), f() +g = [[c == "." for c in eval(input())] for _ in range(h)] +a = [[-3] * w for _ in range(h)] -    lc = rc = 0 +    l = r = 0 -        if g[i][j] == ".": -            lc += 1 -            l[i][j] = lc -        else: -            lc = 0 -        if g[i][-1 - j] == ".": -            rc += 1 -            r[i][-1 - j] = rc -        else: -            rc = 0 -d, u = f(), f() +        l = -~l * g[i][j] +        a[i][j] += l +        r = -~r * g[i][-1 - j] +        a[i][-1 - j] += r -    dc = uc = 0 +    d = u = 0 -        if g[j][i] == ".": -            dc += 1 -            d[j][i] = dc -        else: -            dc = 0 -        if g[-1 - j][i] == ".": -            uc += 1 -            u[-1 - j][i] = uc -        else: -            uc = 0 -print( -    (max(l[i][j] + r[i][j] + d[i][j] + u[i][j] - 3 for i in range(h) for j in range(w))) -) +        d = -~d * g[j][i] +        a[j][i] += d +        u = -~u * g[-1 - j][i] +        a[-1 - j][i] += u +print((max(a[i][j] for i in range(h) for j in range(w))))