import sys

import numba as nb
import numpy as np

input = sys.stdin.readline


@nb.njit("i8(i8,i8,b1[:,:])", cache=True)
def solve(H, W, S):
    U = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    D = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    L = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    R = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if not S[h][w]:
                continue
            if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
            if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

    for h in range(H + 1, 0, -1):
        for w in range(W + 1, 0, -1):
            if not S[h][w]:
                continue
            if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
            if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

    dist = U + D + L + R + 1
    ans = np.max(dist)
    return ans


def main():
    H, W = map(int, input().split())
    S = np.zeros(shape=(H + 2, W + 2), dtype=np.bool)
    for i in range(1, H + 1):
        S[i][1:-1] = [s == "." for s in input().rstrip()]

    ans = solve(H, W, S)

    print(ans)


if __name__ == "__main__":
    main() import sys sys import numba as nb numba import numpy as np numpy input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def solve(H, W, S):
    U = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    D = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    L = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    R = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if not S[h][w]:
                continue
            if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
            if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

    for h in range(H + 1, 0, -1):
        for w in range(W + 1, 0, -1):
            if not S[h][w]:
                continue
            if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
            if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

    dist = U + D + L + R + 1
    ans = np.max(dist)
    return ans solve U = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) U np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) np.full np full shape=(H + 2, W + 2) shape (H + 2, W + 2) H + 2 H 2 W + 2 W 2 fill_value=-1 fill_value -1 dtype=np.int64 dtype np.int64 np int64 D = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) D np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) np.full np full shape=(H + 2, W + 2) shape (H + 2, W + 2) H + 2 H 2 W + 2 W 2 fill_value=-1 fill_value -1 dtype=np.int64 dtype np.int64 np int64 L = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) L np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) np.full np full shape=(H + 2, W + 2) shape (H + 2, W + 2) H + 2 H 2 W + 2 W 2 fill_value=-1 fill_value -1 dtype=np.int64 dtype np.int64 np int64 R = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) R np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64) np.full np full shape=(H + 2, W + 2) shape (H + 2, W + 2) H + 2 H 2 W + 2 W 2 fill_value=-1 fill_value -1 dtype=np.int64 dtype np.int64 np int64 for h in range(1, H + 1):
        for w in range(1, W + 1):
            if not S[h][w]:
                continue
            if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
            if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

     h range(1, H + 1) range 1 H + 1 H 1 for w in range(1, W + 1):
            if not S[h][w]:
                continue
            if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
            if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

     w range(1, W + 1) range 1 W + 1 W 1 if not S[h][w]:
                continue
             not S[h][w] S[h][w] [h] S h w continue if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
             U[h][w] == -1 U[h][w] [h] U h w -1 U[h][w] = 0 U[h][w] [h] U h w 0 d = 0 d 0 while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
             True d += 1 d 1 if not S[h + d][w]:
                        break
                     not S[h + d][w] S[h + d][w] [h + d] S h + d h d w break U[h + d][w] = d U[h + d][w] [h + d] U h + d h d w d if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

     L[h][w] == -1 L[h][w] [h] L h w -1 L[h][w] = 0 L[h][w] [h] L h w 0 d = 0 d 0 while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

     True d += 1 d 1 if not S[h][w + d]:
                        break
                     not S[h][w + d] S[h][w + d] [h] S h w + d w d break L[h][w + d] = d L[h][w + d] [h] L h w + d w d d for h in range(H + 1, 0, -1):
        for w in range(W + 1, 0, -1):
            if not S[h][w]:
                continue
            if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
            if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

     h range(H + 1, 0, -1) range H + 1 H 1 0 -1 for w in range(W + 1, 0, -1):
            if not S[h][w]:
                continue
            if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
            if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

     w range(W + 1, 0, -1) range W + 1 W 1 0 -1 if not S[h][w]:
                continue
             not S[h][w] S[h][w] [h] S h w continue if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
             D[h][w] == -1 D[h][w] [h] D h w -1 D[h][w] = 0 D[h][w] [h] D h w 0 d = 0 d 0 while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
             True d += 1 d 1 if not S[h - d][w]:
                        break
                     not S[h - d][w] S[h - d][w] [h - d] S h - d h d w break D[h - d][w] = d D[h - d][w] [h - d] D h - d h d w d if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

     R[h][w] == -1 R[h][w] [h] R h w -1 R[h][w] = 0 R[h][w] [h] R h w 0 d = 0 d 0 while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

     True d += 1 d 1 if not S[h][w - d]:
                        break
                     not S[h][w - d] S[h][w - d] [h] S h w - d w d break R[h][w - d] = d R[h][w - d] [h] R h w - d w d d dist = U + D + L + R + 1 dist U + D + L + R + 1 U + D + L + R U + D + L U + D U D L R 1 ans = np.max(dist) ans np.max(dist) np.max np max dist return ans ans H H W W S S @nb.njit("i8(i8,i8,b1[:,:])", cache=True) solve "i8(i8,i8,b1[:,:])", cache=True @nb.njit("i8(i8,i8,b1[:,:])", cache=True) nb.njit "i8(i8,i8,b1[:,:])" cache=True cache True solve def main():
    H, W = map(int, input().split())
    S = np.zeros(shape=(H + 2, W + 2), dtype=np.bool)
    for i in range(1, H + 1):
        S[i][1:-1] = [s == "." for s in input().rstrip()]

    ans = solve(H, W, S)

    print(ans) main H, W = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W S = np.zeros(shape=(H + 2, W + 2), dtype=np.bool) S np.zeros(shape=(H + 2, W + 2), dtype=np.bool) np.zeros np zeros shape=(H + 2, W + 2) shape (H + 2, W + 2) H + 2 H 2 W + 2 W 2 dtype=np.bool dtype np.bool np bool for i in range(1, H + 1):
        S[i][1:-1] = [s == "." for s in input().rstrip()]

     i range(1, H + 1) range 1 H + 1 H 1 s == "." for s in input().rstrip() for s in input().rstrip() s input().rstrip() ().rstrip () input rstrip for s in input().rstrip() s == "." s "." S[i][1:-1] = [s == "." for s in input().rstrip()] S[i][1:-1] [i] S i 1:-1 1 -1 [s == "." for s in input().rstrip()] ans = solve(H, W, S) ans solve(H, W, S) solve H W S print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    H, W = map(int, input().split())
    S = np.zeros(shape=(H + 2, W + 2), dtype=np.bool)
    for i in range(1, H + 1):
        S[i][1:-1] = [s == "." for s in input().rstrip()]

    ans = solve(H, W, S)

    print(ans) def main():
    H, W = map(int, input().split())
    S = np.zeros(shape=(H + 2, W + 2), dtype=np.bool)
    for i in range(1, H + 1):
        S[i][1:-1] = [s == "." for s in input().rstrip()]

    ans = solve(H, W, S)

    print(ans) main def solve(H, W, S):
    U = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    D = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    L = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    R = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if not S[h][w]:
                continue
            if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
            if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

    for h in range(H + 1, 0, -1):
        for w in range(W + 1, 0, -1):
            if not S[h][w]:
                continue
            if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
            if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

    dist = U + D + L + R + 1
    ans = np.max(dist)
    return ans def solve(H, W, S):
    U = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    D = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    L = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    R = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if not S[h][w]:
                continue
            if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
            if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

    for h in range(H + 1, 0, -1):
        for w in range(W + 1, 0, -1):
            if not S[h][w]:
                continue
            if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
            if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

    dist = U + D + L + R + 1
    ans = np.max(dist)
    return ans solve input = sys.stdin.readline sys.stdin.readline input
import sys

import numba as nb
import numpy as np

input = sys.stdin.readline


@nb.njit("i8(i8,i8,b1[:,:])", cache=True)
def solve(H, W, S):
    U = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    D = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    L = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    R = np.full(shape=(H + 2, W + 2), fill_value=-1, dtype=np.int64)
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if not S[h][w]:
                continue
            if U[h][w] == -1:
                U[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h + d][w]:
                        break
                    U[h + d][w] = d
            if L[h][w] == -1:
                L[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w + d]:
                        break
                    L[h][w + d] = d

    for h in range(H + 1, 0, -1):
        for w in range(W + 1, 0, -1):
            if not S[h][w]:
                continue
            if D[h][w] == -1:
                D[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h - d][w]:
                        break
                    D[h - d][w] = d
            if R[h][w] == -1:
                R[h][w] = 0
                d = 0
                while True:
                    d += 1
                    if not S[h][w - d]:
                        break
                    R[h][w - d] = d

    dist = U + D + L + R + 1
    ans = np.max(dist)
    return ans


def main():
    H, W = map(int, input().split())
    S = np.zeros(shape=(H + 2, W + 2), dtype=np.bool)
    for i in range(1, H + 1):
        S[i][1:-1] = [s == "." for s in input().rstrip()]

    ans = solve(H, W, S)

    print(ans)


if __name__ == "__main__":
    main()
