H, W = map(int, input().split(" ")) A = ["#" * (W+1)] + ["#" + input() for _ in range(H)] MAX_J = 100 dp = [[[0 for _ in range(MAX_J)] for _ in range(W+1)] for _ in range(H+1)] for h in range(1, H+1): for w in range(1, W+1): if w == 1 and h == 1: dp[h][w][1] = 1 elif A[h][w] == "#": continue elif A[h][w] == "o": for k in range(1, MAX_J): dp[h][w][k] = dp[h-1][w][k-1] + dp[h][w-1][k-1] else: for k in range(MAX_J-1): dp[h][w][k] = dp[h-1][w][k+1] + dp[h][w-1][k+1] print(sum(dp[H][W]))