#!/usr/bin/python3 import bisect import collections import heapq import itertools import math import os import sys def main(): h, w = read_ints() A = [inp() for _ in range(h)] n = h + w - 1 dp = list3d(h, w, n + 1, 0) dp[0][0][1] = 1 for y in range(h): for x in range(w): for c in range(n): v = dp[y][x][c] if x + 1 < w: ch = A[y][x + 1] if ch == 'o': dp[y][x + 1][c + 1] += v elif ch == 'x' and c > 0: dp[y][x + 1][c - 1] += v if y + 1 < h: ch = A[y + 1][x] if ch == 'o': dp[y + 1][x][c + 1] += v elif ch == 'x' and c > 0: dp[y + 1][x][c - 1] += v ans = 0 for c in range(n + 1): ans += dp[h - 1][w - 1][c] print(ans) ############################################################################### DEBUG = 'DEBUG' in os.environ def inp(): return sys.stdin.readline().rstrip() def read_int(): return int(inp()) def read_ints(): return [int(e) for e in inp().split()] def list2d(d1, d2, init=None): return [[init] * d2 for _ in range(d1)] def list3d(d1, d2, d3, init=None): return [[[init] * d3 for _ in range(d2)] for _ in range(d1)] def list4d(d1, d2, d3, d4, init=None): return [[[[init] * d4 for _ in range(d3)] for _ in range(d2)] for _ in range(d1)] def debug(fmt, *args): if DEBUG: if args: print(fmt.format(*args), file=sys.stderr) else: print(fmt, file=sys.stderr) if __name__ == '__main__': main()