#MMA Contest 018 C H, W = map(int, input().split()) A = [input() for _ in range(H)] #DP[h][w][c]: A[h][w]に到達し、進入処理を終えた後、宝石をc個所持 DP = [[[0] * (H + W + 1) for w in range(W)] for h in range(H)] DP[0][0][1] = 1 for h in range(H): for w in range(W): for c in range(H + W + 1): for x, y in [(h + 1, w), (h, w + 1)]: if x not in range(H) or y not in range(W): continue if A[x][y] == '#': continue if A[x][y] == 'o': if c < H + W: DP[x][y][c + 1] += DP[h][w][c] if A[x][y] == 'x': if c > 0: DP[x][y][c - 1] += DP[h][w][c] print(sum(DP[-1][-1][c] for c in range(H + W + 1)))