h, w = map(int, input().split()) a = [list(input()) for _ in range(h)] dp = [[[0 for _ in range(101)] for _ in range(w)] for _ in range(h)] dp[0][0][1] = 1 for i in range(h): for j in range(w): # start position if a[i][j] == "#": continue for k in range(100): if i + 1 < h: if a[i + 1][j] == "x": if k > 0: dp[i + 1][j][k - 1] += dp[i][j][k] if a[i + 1][j] == "o": dp[i + 1][j][k + 1] += dp[i][j][k] if j + 1 < w: if a[i][j + 1] == "x": if k > 0: dp[i][j + 1][k - 1] += dp[i][j][k] if a[i][j + 1] == "o": dp[i][j + 1][k + 1] += dp[i][j][k] ans = 0 # print(dp[h - 1][w - 1][0]) for i in range(1, 101): ans += dp[h - 1][w - 1][i] # print(dp[0][1]) # print(dp[1][2]) # print(dp[2][1]) # print(dp[2][2]) # print(dp[0][2]) # print(dp[1][2]) # print(dp[2][1]) print(ans)