import sys

def solve(H: int, W: int, S: "List[int]"):
    # print(S)

    hcnts = [[0]*W for _ in range(H)]
    for h in range(H):
        hcnts[h][0] = S[h][0]
        for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
    for h in range(H):
        for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

    wcnts = [[0]*W for _ in range(H)]
    for h in range(W):
        wcnts[0][h] = S[0][h]
        for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
    for h in range(W):
        for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
    a = [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)]
    print(max(a))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)

if __name__ == '__main__':
    main() import sys sys def solve(H: int, W: int, S: "List[int]"):
    # print(S)

    hcnts = [[0]*W for _ in range(H)]
    for h in range(H):
        hcnts[h][0] = S[h][0]
        for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
    for h in range(H):
        for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

    wcnts = [[0]*W for _ in range(H)]
    for h in range(W):
        wcnts[0][h] = S[0][h]
        for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
    for h in range(W):
        for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
    a = [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)]
    print(max(a))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) solve [0]*W for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0]*W [0] 0 W hcnts = [[0]*W for _ in range(H)] hcnts [[0]*W for _ in range(H)] for h in range(H):
        hcnts[h][0] = S[h][0]
        for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
     h range(H) range H hcnts[h][0] = S[h][0] hcnts[h][0] [h] hcnts h 0 S[h][0] [h] S h 0 for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
     t range(1,W) range 1 W hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t] hcnts[h][t] [h] hcnts h t (S[h][t]+hcnts[h][t-1])*S[h][t] S[h][t]+hcnts[h][t-1] S[h][t] [h] S h t hcnts[h][t-1] [h] hcnts h t-1 t 1 S[h][t] [h] S h t for h in range(H):
        for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

     h range(H) range H for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

     t range(W-2,-1,-1) range W-2 W 2 -1 -1 hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t]) hcnts[h][t] [h] hcnts h t max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t]) max(hcnts[h][t],hcnts[h][t+1]) max hcnts[h][t] [h] hcnts h t hcnts[h][t+1] [h] hcnts h t+1 t 1 bool(hcnts[h][t]) bool hcnts[h][t] [h] hcnts h t [0]*W for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0]*W [0] 0 W wcnts = [[0]*W for _ in range(H)] wcnts [[0]*W for _ in range(H)] for h in range(W):
        wcnts[0][h] = S[0][h]
        for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
     h range(W) range W wcnts[0][h] = S[0][h] wcnts[0][h] [0] wcnts 0 h S[0][h] [0] S 0 h for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
     t range(1,H) range 1 H wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h] wcnts[t][h] [t] wcnts t h (S[t][h]+wcnts[t-1][h])*S[t][h] S[t][h]+wcnts[t-1][h] S[t][h] [t] S t h wcnts[t-1][h] [t-1] wcnts t-1 t 1 h S[t][h] [t] S t h for h in range(W):
        for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
     h range(W) range W for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
     t range(H-2,-1,-1) range H-2 H 2 -1 -1 wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h]) wcnts[t][h] [t] wcnts t h max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h]) max(wcnts[t][h],wcnts[t+1][h]) max wcnts[t][h] [t] wcnts t h wcnts[t+1][h] [t+1] wcnts t+1 t 1 h bool(wcnts[t][h]) bool wcnts[t][h] [t] wcnts t h hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W) for h in range(H) for w in range(W) h range(H) range H for w in range(W) w range(W) range W for w in range(W) hcnts[h][w]+wcnts[h][w]-1 hcnts[h][w]+wcnts[h][w] hcnts[h][w] [h] hcnts h w wcnts[h][w] [h] wcnts h w 1 a = [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)] a [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)] print(max(a)) print max(a) max a return H: int H W: int W S: "List[int]" S def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)]  # type: "List[str]"
    solve(H, W, S) main def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
     iterate_tokens for line in sys.stdin:
            for word in line.split():
                yield word
     line sys.stdin sys stdin for word in line.split():
                yield word
     word line.split() line.split line split yield word word tokens = iterate_tokens() tokens iterate_tokens() iterate_tokens H = int(next(tokens)) H int(next(tokens)) int next(tokens) next tokens W = int(next(tokens)) W int(next(tokens)) int next(tokens) next tokens [ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] S = [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)] S [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)] solve(H, W, S) solve H W S if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def solve(H: int, W: int, S: "List[int]"):
    # print(S)

    hcnts = [[0]*W for _ in range(H)]
    for h in range(H):
        hcnts[h][0] = S[h][0]
        for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
    for h in range(H):
        for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

    wcnts = [[0]*W for _ in range(H)]
    for h in range(W):
        wcnts[0][h] = S[0][h]
        for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
    for h in range(W):
        for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
    a = [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)]
    print(max(a))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) def solve(H: int, W: int, S: "List[int]"):
    # print(S)

    hcnts = [[0]*W for _ in range(H)]
    for h in range(H):
        hcnts[h][0] = S[h][0]
        for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
    for h in range(H):
        for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

    wcnts = [[0]*W for _ in range(H)]
    for h in range(W):
        wcnts[0][h] = S[0][h]
        for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
    for h in range(W):
        for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
    a = [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)]
    print(max(a))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) solve def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)]  # type: "List[str]"
    solve(H, W, S) def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)]  # type: "List[str]"
    solve(H, W, S) main
import sys

def solve(H: int, W: int, S: "List[int]"):
    # print(S)

    hcnts = [[0]*W for _ in range(H)]
    for h in range(H):
        hcnts[h][0] = S[h][0]
        for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
    for h in range(H):
        for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

    wcnts = [[0]*W for _ in range(H)]
    for h in range(W):
        wcnts[0][h] = S[0][h]
        for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
    for h in range(W):
        for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
    a = [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)]
    print(max(a))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)

if __name__ == '__main__':
    main()
