h,*s=open(0)

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

r=range

a,b,c,d=eval('eval("w*[0],"*h),'*4)

for i in r(h*w):i,j=i//w,i%w;f=s[i][j]>'#';a[i][j]=-~a[i][j-1]*f;b[i][~j]=-~b[i][-j]*(s[i][-j-2]>'#');c[i][j]=-~c[i-1][j]*f;d[~i][j]=-~d[-i][j]*(s[~i][j]>'#')

print((max(a[i][j]+b[i][j]+c[i][j]+d[i][j]-3for i in r(h)for j in r(w))))
from numpy import*

h,*s=open(0)

h,w=int64(h.split())

r=range

s=array([list(t[:-1])for t in s])

a,b,c,d=eval('zeros((h,w),"i"),'*4)

for i in r(w):

    a[:,i]=-~a[:,i-1]*(s[:,i]>'#')

    b[:,~i]=-~b[:,-i]*(s[:,~i]>'#')

for i in r(h):

    c[i,:]=-~c[i-1,:]*(s[i,:]>'#')

    d[~i,:]=-~d[-i,:]*(s[~i,:]>'#')

print((int((a+b+c+d).max())-3))
h, *s = open(0)
h, w = list(map(int, h.split()))
r = range
a, b, c, d = eval('eval("w*[0],"*h),' * 4)
for i in r(h * w):
    i, j = i // w, i % w
    f = s[i][j] > "#"
    a[i][j] = -~a[i][j - 1] * f
    b[i][~j] = -~b[i][-j] * (s[i][-j - 2] > "#")
    c[i][j] = -~c[i - 1][j] * f
    d[~i][j] = -~d[-i][j] * (s[~i][j] > "#")
print((max(a[i][j] + b[i][j] + c[i][j] + d[i][j] - 3 for i in r(h) for j in r(w))))

from numpy import *

h, *s = open(0)
h, w = int64(h.split())
r = range
s = array([list(t[:-1]) for t in s])
a, b, c, d = eval('zeros((h,w),"i"),' * 4)
for i in r(w):
    a[:, i] = -~a[:, i - 1] * (s[:, i] > "#")
    b[:, ~i] = -~b[:, -i] * (s[:, ~i] > "#")
for i in r(h):
    c[i, :] = -~c[i - 1, :] * (s[i, :] > "#")
    d[~i, :] = -~d[-i, :] * (s[~i, :] > "#")
print((int((a + b + c + d).max()) - 3))

+from numpy import * + -h, w = list(map(int, h.split())) +h, w = int64(h.split()) -a, b, c, d = eval('eval("w*[0],"*h),' * 4) -for i in r(h * w): -    i, j = i // w, i % w -    f = s[i][j] > "#" -    a[i][j] = -~a[i][j - 1] * f -    b[i][~j] = -~b[i][-j] * (s[i][-j - 2] > "#") -    c[i][j] = -~c[i - 1][j] * f -    d[~i][j] = -~d[-i][j] * (s[~i][j] > "#") -print((max(a[i][j] + b[i][j] + c[i][j] + d[i][j] - 3 for i in r(h) for j in r(w)))) +s = array([list(t[:-1]) for t in s]) +a, b, c, d = eval('zeros((h,w),"i"),' * 4) +for i in r(w): +    a[:, i] = -~a[:, i - 1] * (s[:, i] > "#") +    b[:, ~i] = -~b[:, -i] * (s[:, ~i] > "#") +for i in r(h): +    c[i, :] = -~c[i - 1, :] * (s[i, :] > "#") +    d[~i, :] = -~d[-i, :] * (s[~i, :] > "#") +print((int((a + b + c + d).max()) - 3))