H, W = map(int, input().split()) M = 10 A = [] for i in range(H): A.append(list(input())) dp = [[[0] * M for _ in range(W)] for _ in range(H)] dp[0][0][1] = 1 for i in range(H): for j in range(W): if i == j == 0: continue if A[i][j] == "#": continue for m in range(M - 1): if i: if A[i][j] == "o" and m: dp[i][j][m] += dp[i - 1][j][m - 1] if A[i][j] == "x": dp[i][j][m] += dp[i - 1][j][m + 1] if j: if A[i][j] == "o" and m: dp[i][j][m] += dp[i][j - 1][m - 1] if A[i][j] == "x": dp[i][j][m] += dp[i][j - 1][m + 1] print(sum(dp[-1][-1]))