#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 65;
ll C[N][N];
char s[N];
int cnta[N], cntb[N];
ll best;
int r, c;
map<ll, ll> mp;
void dfs(ll x, ll y, int a, int b) {
  ll diff = abs(x - y);
  if (best <= 1 || diff - C[a][r] * C[b][r] >= best) return;
  if (a == r - 1 && b == r - 1) {
    best = min(best, diff);
    return;
  }
  if (a >= r) {
    ll s1 = C[a][r] - C[a - 1][r], s2 = C[b][r];
    dfs(x, y + s1 * s2, a - 1, b);
  }
  if (b >= r) {
    ll s1 = C[a][r], s2 = C[b][r] - C[b - 1][r];
    dfs(x + s1 * s2, y, a, b - 1);
  }
}
ll solve(ll x, ll y, int a, int b) {
  ll diff = abs(x - y), st = (x - y) * 10000 + a * 100 + b;
  if (mp.count(st)) return mp[st];
  ll &ret = mp[st];
  if (diff - C[a][r] * C[b][r] > best) return ret;
  if (a < r || b < r) {
    if (a >= cnta[a + b] && b >= cntb[a + b]) {
      int tmp = a + b;
      a -= cnta[tmp];
      b -= cntb[tmp];
      return ret = C[a + b][a];
    }
    return ret;
  }
  char c = s[a + b - 1];
  if (c != 'B') {
    ll s1 = C[a][r] - C[a - 1][r], s2 = C[b][r];
    ret += solve(x, y + s1 * s2, a - 1, b);
  }
  if (c != 'A') {
    ll s1 = C[a][r], s2 = C[b][r] - C[b - 1][r];
    ret += solve(x + s1 * s2, y, a, b - 1);
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> r >> c;
  for (int i = 0; i <= (r + c) * 2; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
  }
  ll x = 0, y = 0;
  int a = r + c, b = r + c;
  while (a >= r && b >= r) {
    if (x > y) {
      ll s1 = C[a][r] - C[a - 1][r], s2 = C[b][r];
      y += s1 * s2;
      --a;
    } else {
      ll s1 = C[a][r], s2 = C[b][r] - C[b - 1][r];
      x += s1 * s2;
      --b;
    }
  }
  best = abs(x - y);
  dfs(0, 0, r + c, r + c);
  cin >> s;
  for (int i = 0; i < (r + c) * 2; i++) {
    cnta[i + 1] = cnta[i] + (s[i] == 'A');
    cntb[i + 1] = cntb[i] + (s[i] == 'B');
  }
  cout << solve(0, 0, r + c, r + c) << endl;
  return 0;
}
