
let memoize n f =
  let dp = Hashtbl.create n in
  let rec get x =
    try Hashtbl.find dp x with
    | Not_found ->
        let result = f get x in
        Hashtbl.add dp x result;
        result in get

let () = Scanf.scanf "%d %d\n" @@ fun h w ->
  let ass = Array.init h @@ fun _ -> Scanf.scanf "%s\n" @@ fun s -> s in
  let dp = memoize (h * w) @@ fun dp -> function
    | (0, 0) -> 1
    | (i, 0) -> if ass.(i).[0] = '.' then dp (i - 1, 0) else 0
    | (0, j) -> if ass.(0).[j] = '.' then dp (0, j - 1) else 0
    | (i, j) -> if ass.(i).[j] = '.' then (dp (i - 1, j) + dp (i, j - 1)) mod 1000000007 else 0 in
  Printf.printf "%d\n" @@ dp (h - 1, w - 1)
    

