//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using PQ = priority_queue<T>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007; // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const ld PI = acos((ld)-1);
constexpr ll dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
inline void Yes() { cout << "Yes" << ENDL; }
inline void No() { cout << "No" << ENDL; }
inline void YES() { cout << "YES" << ENDL; }
inline void NO() { cout << "NO" << ENDL; }

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T>
vector<T> finddivisor(T x) {  //整数xの約数(xを含む)
  vector<T> divisor;
  for(T i = 1; (i * i) <= x; i++) {
    if(x % i == 0) {
      divisor.push_back(i);
      if(i * i != x) { divisor.push_back(x / i);}
    }
  }
  sort(divisor.begin(), divisor.end());
  return divisor;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(auto&& x: vec) is >> x;
  return is;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}

template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}

template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}


signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,m,k;cin>>n>>m>>k;
  V<ll> v(k);

  V<db> c1(n+2,0),c0=c1;
  c1[n]=c0[n]=0;

  V<bool> dam(n+1,false);
  rep(i,0,k){
    ll x;cin>>x;
    dam[x]=true;
  }

  auto p=[&](int fr,int to)->db{
    if(fr>=to)return 0;

    db ret=1.0/m;
    if(to==n)ret*=(fr+m-n+1);
    return ret;
  };

  ll l=n+1,r=n;
  db s1=0,s0=0;
  repr(i,0,n){
    // i -> [i+1,i+m]
    while(i+1<l){
      l--;
      s1+=c1[l]*p(i,l);
      s0+=(1+c0[l])*p(i,l);
    }
    while(i+m<r){
      s1-=c1[r]*p(i+1,r);
      s0-=(1+c0[r])*p(i+1,r);
      r--;
    }

    if(r==n && i<n-1){
      s1-=c1[r]*p(i+1,r);
      s0-=(1+c0[r])*p(i+1,r);

      s1+=c1[r]*p(i,r);
      s0+=(1+c0[r])*p(i,r);
    }

    if(dam[i]){
      c1[i]=1;
      c0[i]=0;
    }else{
      c1[i]=s1;
      c0[i]=s0;
    }

    //debug(s1,s0);
  }
  //debug(c1);
  //debug(c0);

  if(fabs(1-c1[0])<1e-7)cout<<-1<<ENDL;
  else cout<<c0[0]/(1-c1[0])<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?
//any other simpler approach?
//list all conditions, try mathematical and graphic observation
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

#define MAX_N 1000010
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;

    inv[i]=(inv[i]+MOD)%MOD;
    fac[i]=(fac[i]+MOD)%MOD;
    ifac[i]=(ifac[i]+MOD)%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){// this size is really ok??
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r);
}

ll binom(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  ll res=1;
  for(ll i=0;i<k;i++) res=res*(n-i)%MOD;
  res=res*ifac[k]%MOD;
  return res;
}

ll mod_pow(ll x,ll n){
  x%=MOD;
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n>>=1;
  }
  return res;
}

ll mod_inverse(ll x){
  return mod_pow(x,MOD-2);
}

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

void mul(ll &a,ll b){
  a%=MOD;b%=MOD;
  a=a*b%MOD;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin>>N;
  char AA,AB,BA,BB;
  cin>>AA>>AB>>BA>>BB;

  setComb();

  ll ans=0;
  if(AB=='A'&&AA=='A'){
      ans=1;
  }else if(AB=='B'&&BB=='B'){
      ans=1;
  }else if(AB=='B'&&BB=='A'){
      if(BA=='B'){
          for(ll k=1;;k++){
              ll M=N-k;
              M-=k;
              if(M<0) break;

              ll res=hcomb(k,M);
              add(ans,res);
          }
      }else{
          for(ll k=1;;k++){
              ll M=N-k;
              M-=k;
              if(M<0) break;

              ll res=hcomb(2*k-1,M);
              add(ans,res);
          }
      }
  }else{
      if(BA=='A'){
          for(ll k=1;;k++){
              ll M=N-k;
              M-=k;
              if(M<0) break;

              ll res=hcomb(k,M);
              add(ans,res);
          }
      }else{
          for(ll k=1;;k++){
              ll M=N-k;
              M-=k;
              if(M<0) break;

              ll res=hcomb(2*k-1,M);
              add(ans,res);
          }
      }
  }

  cout<<ans<<endl;

  return 0;
}
