#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template <class T>
void read(T &);
template <class T>
void write(const T &);

typedef long long ll;
typedef unsigned long long ull;
typedef const long long &cll;
typedef const int &ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::abs;
using std::max;
using std::min;

constexpr int N = 3005;
constexpr int Mod = 998244353;

void add(int &a, int b) { (a += b) >= Mod ? a -= Mod : a; }

int dp[N][N];
int n, k;

int main() {
  read(n), read(k);
  dp[0][0] = 1;
  for (int j = 1; j <= n; ++j) {
    for (int i = 1; i <= j; ++i) {
      dp[i][j] = dp[i - 1][j - 1];
      if (2 * i <= j - i) {
        add(dp[i][j], dp[2 * i][j - i]);
      }
      if (2 * i - 1 <= j - i) {
        add(dp[i][j], dp[2 * i - 1][j - i]);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= k; ++i) {
    add(ans, dp[i][n - k]);
  }
  write(ans), EL;
  return 0;
}

template <class T>
inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template <class T>
inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}

#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
string s = "AB";
char c [4];
long long n = 10 , nn , a [20] , mask , dp [1003];
map < string , int > mp;
void f ( )
{
    if ( s . size () == n )
    {
        mp [s] ++;
        return;
    }
    for ( int i = 0 ; i < s . size () - 1 ; i ++ )
    {
        if ( s [i] == 'A' && s [ i + 1 ] == 'A' )
        {
            s . insert ( s . begin () + i + 1 , c [0] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
        if ( s [i] == 'A' && s [ i + 1 ] == 'B' )
        {
            s . insert ( s . begin () + i + 1 , c [1] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
        if ( s [i] == 'B' && s [ i + 1 ] == 'A' )
        {
            s . insert ( s . begin () + i + 1 , c [2] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
        if ( s [i] == 'B' && s [ i + 1 ] == 'B' )
        {
            s . insert ( s . begin () + i + 1 , c [3] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
    }
}
void F ( int x , int mask )
{
    if ( x == 4 )
    {
        f ();
        a [mask] = mp . size ();
        mp . clear ();
        return;
    }
    c [x] = 'A';
    F ( x + 1 , mask );
    c [x] = 'B';
    F ( x + 1 , ( mask | ( 1 << x ) ) );
}
long long pw ( long long x , long long y )
{
    if ( y == 0 ) return 1;
    long long ans = pw ( x , y / 2 );
    ans = ( ans * ans ) % mod;
    if ( y % 2 ) ans = ( ans * x ) % mod;
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("milk.in","r",stdin);
    //freopen("milk.out","w",stdout);
    cin >> nn;
    if ( nn == 2 )
    {
        cout << 1;
        return 0;
    }
    F ( 0 , 0 );
    for ( int i = 0 ; i < 4 ; i ++ )
    {
        char c;
        cin >> c;
        if ( c == 'B' ) mask = ( mask | ( 1 << i ) );
    }
    if ( a [mask] == 1 ) cout << 1;
    if ( a [mask] == 128 ) cout << pw ( 2 , nn - 3 );
    if ( a [mask] == 34 )
    {
        dp [0] = 1 , dp [1] = 1;
        for ( int i = 2 ; i <= nn ; i ++ ) dp [i] = ( dp [ i - 1 ] + dp [ i - 2 ] ) % mod;
        cout << dp [ nn - 2 ];
    }
}
