#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}

int main() {
  int N, M, L;

  auto C = binomial_table< double >(150);

  auto dp = make_v< double >(61, 8, 8);
  auto memo = make_v< int >(61, 8, 8);
  auto rec = MFP([&](auto rec, int M, int N, int L) -> double {
    if(M == 0) return L == 0 ? 1.0 : 0.0;
    if(memo[M][N][L]) return dp[M][N][L];
    memo[M][N][L] = true;
    double ret = 0.0;
    for(int i = 0; i <= N && i <= L; i++) {
      ret += rec(M - 1, N, L - i) * C[N][i];
    }
    return dp[M][N][L] = ret;
  });

  while(cin >> N >> M >> L, N) {
    auto rank = make_v< int >(3, L);
    int any = 0;
    for(int i = 0; i < L; i++) {
      string s;
      cin >> s;
      if(s != "*") ++rank[s[0] - 'a'][(int) s.size() - 1];
      else any++;
    }
    for(int i = 0; i < 3; i++) {
      while(!rank[i].empty() && rank[i].back() == 0) {
        rank[i].pop_back();
      }
    }
    vector< int > op;

    auto is_match = [&]() -> bool {
      for(int i = 0; i + rank[0].size() <= op.size(); i++) {
        bool f1 = true;
        for(int l = 0; l < rank[0].size(); l++) {
          op[i + l] -= rank[0][l];
          f1 &= op[i + l] >= 0;
        }
        if(f1) {
          for(int j = 0; j + rank[1].size() <= op.size(); j++) {
            bool f2 = true;
            for(int l = 0; l < rank[1].size(); l++) {
              op[j + l] -= rank[1][l];
              f2 &= op[j + l] >= 0;
            }
            if(f2) {
              for(int k = 0; k + rank[2].size() <= op.size(); k++) {
                bool f3 = true;
                for(int l = 0; l < rank[2].size(); l++) {
                  op[k + l] -= rank[2][l];
                  f3 &= op[k + l] >= 0;
                }
                for(int l = 0; l < rank[2].size(); l++) {
                  op[k + l] += rank[2][l];
                }
                if(f3) {
                  for(int l = 0; l < rank[1].size(); l++) {
                    op[j + l] += rank[1][l];
                  }
                  for(int l = 0; l < rank[0].size(); l++) {
                    op[i + l] += rank[0][l];
                  }
                  return true;
                }
              }
            }
            for(int l = 0; l < rank[1].size(); l++) {
              op[j + l] += rank[1][l];
            }
          }
        }
        for(int l = 0; l < rank[0].size(); l++) {
          op[i + l] += rank[0][l];
        }
      }
      return false;
    };
    double ue = 0;
    MFP([&](auto generate, int sum, int space) -> void {
      if(sum == L) {
        if(is_match()) {
          int f_sz = 0;
          while(f_sz < op.size() && op[f_sz] > 0) ++f_sz;
          int more = 0;
          for(int i = f_sz + 1; i < op.size(); i++) {
            if(op[i - 1] >= 1 && op[i] >= 1) ++more;
          }
          double mul = 0;
          for(int first = 0; first + f_sz <= M; first++) {
            int rest = M - (first + f_sz) - more;
            if(rest - space >= 0) {
              mul += C[rest - space][space];
            }
          }
          double vv = 1;
          for(int i = 0; i < op.size(); i++) {
            vv *= C[N][op[i]];
          }
          ue += vv * mul;
        }
        return;
      }
      op.emplace_back(0);
      if(op.size() >= 2 && op[op.size() - 2] > 0) {
        generate(sum, space + 1);
      }
      for(int i = 1; i <= N && sum + i <= L; i++) {
        op.back() = i;
        generate(sum + i, space);
      }
      op.pop_back();
    })(0, 0);
    cout << ue / rec(M, N, L) << endl;
  }
}


Measured memory_bytes: 3384