#include using namespace std; using ll=long long; using ld=long double; template using graph=vector>; template using min_priority_queue=priority_queue,greater>; constexpr int INF32=INT_MAX/2; constexpr ll INF64=1LL<<60; constexpr array DX4={0,1,0,-1}; constexpr array DY4={-1,0,1,0}; constexpr array DX8={0,1,1,1,0,-1,-1,-1}; constexpr array DY8={-1,-1,0,1,1,1,0,-1}; inline int popcnt(ll n){return __builtin_popcountll(n);} template inline bool chmax(T& a,const T& b){return a inline bool chmin(T& a,const T& b){return b=(ll)(n);i--) void _main(); int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); cout<> H >> W; vector S(H); rep(i,0,H) cin >> S[i]; vector dp(H, vector(W, vector(H+W))); dp[0][0][1] = 1; rep(i,0,H) rep(j,0,W) if(S[i][j]!='#'){ rep(k,0,H+W){ if(i+1=0) dp[i+1][j][k-1] += dp[i][j][k]; } } if(j+1=0) dp[i][j+1][k-1] += dp[i][j][k]; } } } } ll ans = 0; rep(i,0,H+W){ ans += dp[H-1][W-1][i]; } cout << ans << endl; }