import sys sys.setrecursionlimit(1000000) h, w = map(int, input().split()) grid = [] for _ in range(h): line = list(input()) grid.append(line) minimum_count = 100 ans = 0 def dfs(i, j, stone, visited): # print(i, j) if i < 0 or i >= h or j < 0 or j >= w: return global minimum_count, ans visited[i][j] = True if grid[i][j] == "o": stone += 1 if grid[i][j] == "x": stone -= 1 if stone < 0: return if i == h-1 and j == w-1: ans += 1 return for dx, dy in [[0, 1], [1, 0]]: if i+dx < 0 or i+dx >= h or j+dy < 0 or j+dy >= w: continue if grid[i+dx][j+dy] == "#": continue else: dfs(i+dx, j+dy, stone, visited.copy()) dfs(0, 0, 0, [[False]*w for _ in range(h)]) print(ans)