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

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

d1=[[0]*(w+1) for _ in range(h+1)]

d2=[[0]*(w+1) for _ in range(h+1)]

for i in range(h):

  k=1

  for j in range(w):

    if s[i][j]=='.':d1[i+1][k]+=1

    else:k=j+2

  for j in range(w):

    if s[i][j]=='.':d1[i+1][j+1]+=d1[i+1][j]

for j in range(w):

  k=1

  for i in range(h):

    if s[i][j]=='.':d2[k][j+1]+=1

    else:k=i+2

  for i in range(h):

    if s[i][j]=='.':d2[i+1][j+1]+=d2[i][j+1]

ans=0

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

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

    d1[i][j]+=d2[i][j]-1

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

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

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

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

for i in range(h):

  cnt=0

  for j in range(w):

    if s[i][j]=='.':cnt+=1

    else:

      for k in range(cnt):

        a[i][j-k-1]=cnt

      cnt=0

  for k in range(cnt):

    a[i][j-k]=cnt

for i in range(w):

  cnt=0

  for j in range(h):

    if s[j][i]=='.':cnt+=1

    else:

      for k in range(cnt):

        a[j-k-1][i]+=cnt

      cnt=0

  for k in range(cnt):

    a[j-k][i]+=cnt

ans=0

for i in range(h):

  for j in range(w):

    ans=max(ans,a[i][j])

print((ans-1))
h, w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
d1 = [[0] * (w + 1) for _ in range(h + 1)]
d2 = [[0] * (w + 1) for _ in range(h + 1)]
for i in range(h):
    k = 1
    for j in range(w):
        if s[i][j] == ".":
            d1[i + 1][k] += 1
        else:
            k = j + 2
    for j in range(w):
        if s[i][j] == ".":
            d1[i + 1][j + 1] += d1[i + 1][j]
for j in range(w):
    k = 1
    for i in range(h):
        if s[i][j] == ".":
            d2[k][j + 1] += 1
        else:
            k = i + 2
    for i in range(h):
        if s[i][j] == ".":
            d2[i + 1][j + 1] += d2[i][j + 1]
ans = 0
for i in range(1, h + 1):
    for j in range(1, w + 1):
        d1[i][j] += d2[i][j] - 1
    ans = max(ans, max(d1[i]))
print(ans)

h, w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
a = [[0] * w for _ in range(h)]
for i in range(h):
    cnt = 0
    for j in range(w):
        if s[i][j] == ".":
            cnt += 1
        else:
            for k in range(cnt):
                a[i][j - k - 1] = cnt
            cnt = 0
    for k in range(cnt):
        a[i][j - k] = cnt
for i in range(w):
    cnt = 0
    for j in range(h):
        if s[j][i] == ".":
            cnt += 1
        else:
            for k in range(cnt):
                a[j - k - 1][i] += cnt
            cnt = 0
    for k in range(cnt):
        a[j - k][i] += cnt
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, a[i][j])
print((ans - 1))

-d1 = [[0] * (w + 1) for _ in range(h + 1)] -d2 = [[0] * (w + 1) for _ in range(h + 1)] +a = [[0] * w for _ in range(h)] -    k = 1 +    cnt = 0 -            d1[i + 1][k] += 1 +            cnt += 1 -            k = j + 2 +            for k in range(cnt): +                a[i][j - k - 1] = cnt +            cnt = 0 +    for k in range(cnt): +        a[i][j - k] = cnt +for i in range(w): +    cnt = 0 +    for j in range(h): +        if s[j][i] == ".": +            cnt += 1 +        else: +            for k in range(cnt): +                a[j - k - 1][i] += cnt +            cnt = 0 +    for k in range(cnt): +        a[j - k][i] += cnt +ans = 0 +for i in range(h): -        if s[i][j] == ".": -            d1[i + 1][j + 1] += d1[i + 1][j] -for j in range(w): -    k = 1 -    for i in range(h): -        if s[i][j] == ".": -            d2[k][j + 1] += 1 -        else: -            k = i + 2 -    for i in range(h): -        if s[i][j] == ".": -            d2[i + 1][j + 1] += d2[i][j + 1] -ans = 0 -for i in range(1, h + 1): -    for j in range(1, w + 1): -        d1[i][j] += d2[i][j] - 1 -    ans = max(ans, max(d1[i])) -print(ans) +        ans = max(ans, a[i][j]) +print((ans - 1))