from itertools import product
import numpy as np

h, w = map(int, input().split())
notwall = []
for _ in range(h):
    s = input()
    notwall.append([int(c == '.') for c in s])

notwall = np.array(notwall)


def getll():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

    ls = ls[:, 1:]
    return ls


def getlr():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

    ls = ls[:, :-1]
    return ls


def getlu():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

    ls = ls[1:, :]
    return ls


def getld():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

    ls = ls[:-1, :]
    return ls


ll = getll()
lr = getlr()
lu = getlu()
ld = getld()

m = max([0, np.max(ll + lr + lu + ld) - 3])

print(m)
 from itertools import product import numpy as np numpy h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w notwall = [] notwall [] for _ in range(h):
    s = input()
    notwall.append([int(c == '.') for c in s]) _ range(h) range h s = input() s input() input int(c == '.') for c in s for c in s c s for c in s int(c == '.') int c == '.' c '.' notwall.append([int(c == '.') for c in s]) notwall.append notwall append [int(c == '.') for c in s] notwall = np.array(notwall) notwall np.array(notwall) np.array np array notwall def getll():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

    ls = ls[:, 1:]
    return ls getll ls = np.zeros((h, w + 1), dtype=int) ls np.zeros((h, w + 1), dtype=int) np.zeros np zeros (h, w + 1) h w + 1 w 1 dtype=int dtype int for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

     i range(w) range w ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i] ls[:, i + 1] ls : (ls[:, i] + 1) * notwall[:, i] ls[:, i] + 1 ls[:, i] ls : 1 notwall[:, i] notwall : ls = ls[:, 1:] ls ls[:, 1:] ls : return ls ls def getlr():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

    ls = ls[:, :-1]
    return ls getlr ls = np.zeros((h, w + 1), dtype=int) ls np.zeros((h, w + 1), dtype=int) np.zeros np zeros (h, w + 1) h w + 1 w 1 dtype=int dtype int for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

     i range(w - 1, -1, -1) range w - 1 w 1 -1 -1 ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i] ls[:, i] ls : (ls[:, i + 1] + 1) * notwall[:, i] ls[:, i + 1] + 1 ls[:, i + 1] ls : 1 notwall[:, i] notwall : ls = ls[:, :-1] ls ls[:, :-1] ls : return ls ls def getlu():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

    ls = ls[1:, :]
    return ls getlu ls = np.zeros((h + 1, w), dtype=int) ls np.zeros((h + 1, w), dtype=int) np.zeros np zeros (h + 1, w) h + 1 h 1 w dtype=int dtype int for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

     i range(h) range h ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :] ls[i + 1, :] ls i + 1 i 1 (ls[i, :] + 1) * notwall[i, :] ls[i, :] + 1 ls[i, :] ls i 1 notwall[i, :] notwall i ls = ls[1:, :] ls ls[1:, :] ls 1: 1 return ls ls def getld():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

    ls = ls[:-1, :]
    return ls getld ls = np.zeros((h + 1, w), dtype=int) ls np.zeros((h + 1, w), dtype=int) np.zeros np zeros (h + 1, w) h + 1 h 1 w dtype=int dtype int for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

     i range(h - 1, -1, -1) range h - 1 h 1 -1 -1 ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :] ls[i, :] ls i (ls[i + 1, :] + 1) * notwall[i, :] ls[i + 1, :] + 1 ls[i + 1, :] ls i + 1 i 1 1 notwall[i, :] notwall i ls = ls[:-1, :] ls ls[:-1, :] ls :-1 -1 return ls ls ll = getll() ll getll() getll lr = getlr() lr getlr() getlr lu = getlu() lu getlu() getlu ld = getld() ld getld() getld m = max([0, np.max(ll + lr + lu + ld) - 3]) m max([0, np.max(ll + lr + lu + ld) - 3]) max [0, np.max(ll + lr + lu + ld) - 3] 0 np.max(ll + lr + lu + ld) - 3 np.max(ll + lr + lu + ld) np.max np max ll + lr + lu + ld ll + lr + lu ll + lr ll lr lu ld 3 print(m) print m notwall = np.array(notwall) np.array(notwall) notwall s = input() input() s notwall = [] [] notwall lu = getlu() getlu() lu m = max([0, np.max(ll + lr + lu + ld) - 3]) max([0, np.max(ll + lr + lu + ld) - 3]) m ll = getll() getll() ll def getll():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

    ls = ls[:, 1:]
    return ls def getll():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

    ls = ls[:, 1:]
    return ls getll ld = getld() getld() ld h, w = map(int, input().split()) map(int, input().split()) h def getlu():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

    ls = ls[1:, :]
    return ls def getlu():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

    ls = ls[1:, :]
    return ls getlu def getlr():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

    ls = ls[:, :-1]
    return ls def getlr():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

    ls = ls[:, :-1]
    return ls getlr def getld():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

    ls = ls[:-1, :]
    return ls def getld():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

    ls = ls[:-1, :]
    return ls getld lr = getlr() getlr() lr w = map(int, input().split()) map(int, input().split()) w
from itertools import product
import numpy as np

h, w = map(int, input().split())
notwall = []
for _ in range(h):
    s = input()
    notwall.append([int(c == '.') for c in s])

notwall = np.array(notwall)


def getll():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w):
        ls[:, i + 1] = (ls[:, i] + 1) * notwall[:, i]

    ls = ls[:, 1:]
    return ls


def getlr():
    ls = np.zeros((h, w + 1), dtype=int)

    for i in range(w - 1, -1, -1):
        ls[:, i] = (ls[:, i + 1] + 1) * notwall[:, i]

    ls = ls[:, :-1]
    return ls


def getlu():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h):
        ls[i + 1, :] = (ls[i, :] + 1) * notwall[i, :]

    ls = ls[1:, :]
    return ls


def getld():
    ls = np.zeros((h + 1, w), dtype=int)

    for i in range(h - 1, -1, -1):
        ls[i, :] = (ls[i + 1, :] + 1) * notwall[i, :]

    ls = ls[:-1, :]
    return ls


ll = getll()
lr = getlr()
lu = getlu()
ld = getld()

m = max([0, np.max(ll + lr + lu + ld) - 3])

print(m)

