import sys input = sys.stdin.readline sys.setrecursionlimit(10**8) def dfs(y, x, cnt): if A[y][x] == "o": cnt += 1 if A[y][x] == "x": cnt -= 1 if A[y][x] == "#": cnt = -float("INF") if cnt < 0: return if y == H - 1 and x == W - 1: global ans ans += 1 if y != H - 1: dfs(y + 1, x, cnt) if x != W - 1: dfs(y, x + 1, cnt) H, W = map(int, input().split()) A = [list(input()[:-1]) for _ in range(H)] ans = 0 dfs(0, 0, 0) print(ans)