def main():

    H, W = list(map(int, input().split()))

    a = [i == '.' for i in eval(input())]

    v = [0] * W

    v[0] = 1

    for j in range(1, W):

        if not a[j]:

            break

        v[j] = 1



    for i in range(1, H):

        a = [i == '.' for i in eval(input())]

        u = v

        v = [0] * W

        v[0] = u[0] if a[0] else 0

        for j in range(1, W):

            v[j] = u[j] + v[j - 1] if a[j] else 0

    print((v[-1] % (10 ** 9 + 7)))





main()

def main():

    H, W = list(map(int, input().split()))

    a = eval(input())

    k = a.find('#')

    if k == -1:

        k = W

    v = [1] * k + [0] * (W - k)

    u = [0] * W



    for _ in range(1, H):

        a = eval(input())

        u, v = v, u

        v[0] = t = u[0] if a[0] == '.' else 0

        for j, uu, aa in zip(list(range(1, W)), u[1:], a[1:]):

            v[j] = t = uu + t if aa == '.' else 0

    print((v[-1] % (10 ** 9 + 7)))





main()

def main():
    H, W = list(map(int, input().split()))
    a = [i == "." for i in eval(input())]
    v = [0] * W
    v[0] = 1
    for j in range(1, W):
        if not a[j]:
            break
        v[j] = 1
    for i in range(1, H):
        a = [i == "." for i in eval(input())]
        u = v
        v = [0] * W
        v[0] = u[0] if a[0] else 0
        for j in range(1, W):
            v[j] = u[j] + v[j - 1] if a[j] else 0
    print((v[-1] % (10**9 + 7)))


main()

def main():
    H, W = list(map(int, input().split()))
    a = eval(input())
    k = a.find("#")
    if k == -1:
        k = W
    v = [1] * k + [0] * (W - k)
    u = [0] * W
    for _ in range(1, H):
        a = eval(input())
        u, v = v, u
        v[0] = t = u[0] if a[0] == "." else 0
        for j, uu, aa in zip(list(range(1, W)), u[1:], a[1:]):
            v[j] = t = uu + t if aa == "." else 0
    print((v[-1] % (10**9 + 7)))


main()

-    a = [i == "." for i in eval(input())] -    v = [0] * W -    v[0] = 1 -    for j in range(1, W): -        if not a[j]: -            break -        v[j] = 1 -    for i in range(1, H): -        a = [i == "." for i in eval(input())] -        u = v -        v = [0] * W -        v[0] = u[0] if a[0] else 0 -        for j in range(1, W): -            v[j] = u[j] + v[j - 1] if a[j] else 0 +    a = eval(input()) +    k = a.find("#") +    if k == -1: +        k = W +    v = [1] * k + [0] * (W - k) +    u = [0] * W +    for _ in range(1, H): +        a = eval(input()) +        u, v = v, u +        v[0] = t = u[0] if a[0] == "." else 0 +        for j, uu, aa in zip(list(range(1, W)), u[1:], a[1:]): +            v[j] = t = uu + t if aa == "." else 0