#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <deque>
#include <set>
#include <limits>
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, a) for (int i = 0; i < (a); ++i)
#define OUT_PREC(a, n) cout << fixed << setprecision(n) << a << endl

// nが一定の時
class CombMod
{
private:
    ll n;
    const ll _MOD = 998244353;
    vector<ll> val;
    vector<ll> inv;

public:
    CombMod(const ll &n0)
    {
        n = n0;
        val.resize(n + 1, 1);
        val[1] = n;
        inv.resize(n + 1, 1);

        // calculate in advance
        for (ll i = 2; i <= n; ++i)
        {
            inv[i] = _MOD - ((inv[_MOD % i] * (ll)(_MOD / i)) % _MOD);
            val[i] = (((val[i - 1] * (n + 1 - i)) % _MOD) * inv[i]) % _MOD;
        }
    }

    ll get(ll k)
    { // mCk
        if (k < 0)
            return 0;
        else
            return val[k];
    }
};

ll solve()
{
    int n, m;
    cin >> n >> m;
    ll MOD = 998244353;
    CombMod cm(n);
    vector<ll> dp(m + 1, 0);
    dp[0] = 1;

    for (int j = 1; j <= (m / 2); ++j)
    {
        for (int k = 0; k <= min(j, n / 2); ++k)
        {
            dp[2 * j] = (dp[2 * j] + ((dp[j - k] * cm.get(2 * k)) % MOD)) % MOD;
        }
    }

    return dp[m];
}

int main()
{
    /* solve */
    cout << solve() << endl;
    // cout << (solve() ? "Yes" : "No") << endl;
    system("pause");
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll mod = 1000000007;
ll dp[2010][2010];
ll x[2010][2010];
ll y[2010][2010];
ll xy[2010][2010];

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    for (int i = 0; i < H; i++) cin >> field[i];
    dp[0][0] = 1;
    x[0][0] = 1;
    y[0][0] = 1;
    xy[0][0] = 1;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i + j == 0) continue;
            if (field[i][j] == '#') {
                x[i][j] = 0;
                y[i][j] = 0;
                xy[i][j] = 0;
                continue;
            }
            if (i > 0) dp[i][j] += y[i - 1][j];
            if (j > 0) dp[i][j] += x[i][j - 1];
            if (i > 0 && j > 0) dp[i][j] += xy[i - 1][j - 1];
            if (i > 0) y[i][j] += y[i - 1][j];
            if (j > 0) x[i][j] += x[i][j - 1];
            if (i > 0 && j > 0) xy[i][j] += xy[i - 1][j - 1];
            x[i][j] += dp[i][j];
            y[i][j] += dp[i][j];
            xy[i][j] += dp[i][j];
            dp[i][j] %= mod;
            x[i][j] %= mod;
            y[i][j] %= mod;
            xy[i][j] %= mod;
        }
    }
    cout << dp[H-1][W-1] << endl;
}