import numpy as np
def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3))

if __name__ == '__main__':
    main() import numpy as np numpy def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3)) main print(x) for x in l for x in l x l for x in l print(x) print x printl = lambda l: [print(x) for x in l] printl lambda l: [print(x) for x in l] [print(x) for x in l] l H, W = list(map(int, input().split())) H list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split W [1 if i == '.' else 0 for i in input()] for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [1 if i == '.' else 0 for i in input()] A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)]) A np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)]) np.array np array [[1 if i == '.' else 0 for i in input()] for _ in range(H)] L = np.zeros((H, W), dtype = np.int) L np.zeros((H, W), dtype = np.int) np.zeros np zeros (H, W) H W dtype = np.int dtype np.int np int R = np.zeros((H, W), dtype = np.int) R np.zeros((H, W), dtype = np.int) np.zeros np zeros (H, W) H W dtype = np.int dtype np.int np int U = np.zeros((H, W), dtype = np.int) U np.zeros((H, W), dtype = np.int) np.zeros np zeros (H, W) H W dtype = np.int dtype np.int np int D = np.zeros((H, W), dtype = np.int) D np.zeros((H, W), dtype = np.int) np.zeros np zeros (H, W) H W dtype = np.int dtype np.int np int L[:, 0] = A[:, 0] L[:, 0] L : A[:, 0] A : for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
     w range(1, W) range 1 W L[:, w] = (L[:, w - 1] + 1) * A[:, w] L[:, w] L : (L[:, w - 1] + 1) * A[:, w] L[:, w - 1] + 1 L[:, w - 1] L : 1 A[:, w] A : R[:, W - 1] = A[:, W - 1] R[:, W - 1] R : A[:, W - 1] A : for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
     w range(W - 2, -1, -1) range W - 2 W 2 -1 -1 R[:, w] = (R[:, w + 1] + 1) * A[:, w] R[:, w] R : (R[:, w + 1] + 1) * A[:, w] R[:, w + 1] + 1 R[:, w + 1] R : 1 A[:, w] A : U[0, :] = A[0, :] U[0, :] U 0 A[0, :] A 0 for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
     h range(1, H) range 1 H U[h, :] = (U[h - 1, :] + 1) * A[h, :] U[h, :] U h (U[h - 1, :] + 1) * A[h, :] U[h - 1, :] + 1 U[h - 1, :] U h - 1 h 1 1 A[h, :] A h D[H - 1, :] = A[H - 1, :] D[H - 1, :] D H - 1 H 1 A[H - 1, :] A H - 1 H 1 for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
     h range(H - 2, -1, -1) range H - 2 H 2 -1 -1 D[h, :] = (D[h + 1, :] + 1) * A[h, :] D[h, :] D h (D[h + 1, :] + 1) * A[h, :] D[h + 1, :] + 1 D[h + 1, :] D h + 1 h 1 1 A[h, :] A h print(np.max(L + R + U + D - 3)) print np.max(L + R + U + D - 3) np.max np max L + R + U + D - 3 L + R + U + D L + R + U L + R L R U D 3 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3)) def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3)) main
import numpy as np
def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3))

if __name__ == '__main__':
    main()
