func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 11, L = 11, N = 1002;   const int Mod = 1e9 + 9;   char a[L], to[99];   int n;   int dp[2][M * L][N], ch[M * L][4], fail[M * L];   int len[N];   int ans = 0;   inline void mo(int& x) { x = (x >= Mod ? x - Mod : x); }   struct AC_automaton {     int cnt;     inline void init() {       cnt = 0;       to[ A ] = 0, to[ C ] = 1, to[ G ] = 2, to[ T ] = 3;     }     inline void insert() {       int l = strlen(a + 1), now = 0;       for (int i = 1; i <= l; i++) {         if (!ch[now][to[a[i]]]) ch[now][to[a[i]]] = ++cnt;         now = ch[now][to[a[i]]];       }       len[now] = max(len[now], l);     }     inline void build() {       queue<int> Q;       for (int i = 0; i < 4; i++)         if (ch[0][i]) Q.push(ch[0][i]);       while (!Q.empty()) {         int x = Q.front();         Q.pop();         len[x] = max(len[x], len[fail[x]]);         for (int i = 0; i < 4; i++) {           if (ch[x][i])             fail[ch[x][i]] = ch[fail[x]][i], Q.push(ch[x][i]);           else             ch[x][i] = ch[fail[x]][i];         }       }     }     inline void work() {       dp[0][0][1] = 1;       for (int i = 1; i <= n; i++) {         memset(dp[i & 1], 0, sizeof(dp[i & 1]));         for (int j = 0; j <= cnt; j++)           for (int k = 0; k <= i; k++) {             if (dp[!(i & 1)][j][k]) {               for (int t = 0; t < 4; t++) {                 if (len[ch[j][t]] + k > i)                   mo(dp[i & 1][ch[j][t]][i + 1] += dp[!(i & 1)][j][k]);                 else                   mo(dp[i & 1][ch[j][t]][k] += dp[!(i & 1)][j][k]);               }             }           }       }       for (int j = 0; j <= cnt; j++) mo(ans += dp[n & 1][j][n + 1]);     }   } T;   int main() {     int m;     scanf( %d%d , &n, &m);     T.init();     for (int i = 1; i <= m; i++) {       scanf( %s , a + 1);       T.insert();     }     T.build();     T.work();     printf( %d , ans);     return 0;   }   