h, w = [int(x) for x in input().split()] a = [input() for _ in range(h)] cnt = [[[0] * 30 for _ in range(w)] for _ in range(h)] cnt[0][0][1] = 1 for i in range(h): for j in range(w): for k in range(25): if i < h - 1: if a[i+1][j] == "o": cnt[i+1][j][k+1] += cnt[i][j][k] elif a[i+1][j] == "x" and k > 0: cnt[i+1][j][k-1] += cnt[i][j][k] if j < w - 1: if a[i][j+1] == "o": cnt[i][j+1][k+1] += cnt[i][j][k] elif a[i][j+1] == "x" and k > 0: cnt[i][j+1][k-1] += cnt[i][j][k] print(sum(cnt[h-1][w-1]))