1 #include<cstdio>
2
3 #include<cstdlib>
4
5 #include<cmath>
6
7 #include<cstring>
8
9 #include<algorithm>
10
11 #include<iostream>
12
13 #include<vector>
14
15 #include<map>
16
17 #include<set>
18
19 #include<queue>
20
21 #include<string>
22
23 #define inf 1000000000
24
25 #define maxn 200+5
26
27 #define eps 1e-10
28
29 #define ll long long
30
31 #define pa pair<int,int>
32
33 #define for0(i,n) for(int i=0;i<=(n);i++)
34
35 #define for1(i,n) for(int i=1;i<=(n);i++)
36
37 #define for2(i,x,y) for(int i=(x);i<=(y);i++)
38
39 #define for3(i,x,y) for(int i=(x);i>=(y);i--)
40
41 #define mod 1000000007
42
43 using namespace std;
44
45 inline int read()
46
47 {
48
49 int x=0,f=1;char ch=getchar();
50
51 while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();}
52
53 while(ch>=‘0‘&&ch<=‘9‘){x=10*x+ch-‘0‘;ch=getchar();}
54
55 return x*f;
56
57 }
58 int n,m,k,cnt,t[maxn][26],go[maxn];
59 bool v[maxn],vis[maxn];
60 queue<int>q;
61 char s[maxn];
62 struct matrix
63 {
64 long double d[maxn][maxn];
65 matrix(){memset(d,0,sizeof(d));}
66 }a,b,c;
67 inline void add()
68 {
69 scanf("%s",s+1);int len=strlen(s+1),now=1;
70 for1(i,len)
71 {
72 int x=s[i]-‘a‘;
73 if(!t[now][x])t[now][x]=++cnt;
74 now=t[now][x];
75 }
76 v[now]=1;
77 }
78 void bfs()
79 {
80 q.push(1);
81 while(!q.empty())
82 {
83 int x=q.front(),y,j;q.pop();
84 v[x]|=v[go[x]];
85 for0(i,k-1)
86 {
87 j=go[x];
88 while(j&&!t[j][i])j=go[j];
89 if(t[x][i])
90 {
91 go[y=t[x][i]]=j?t[j][i]:1;
92 q.push(y);
93 }else t[x][i]=j?t[j][i]:1;
94 }
95 }
96 }
97 void build()
98 {
99 vis[1]=1;
100 q.push(1);long double tmp=1.0/k;
101 while(!q.empty())
102 {
103 int x=q.front();q.pop();
104 for0(i,k-1)
105 {
106 if(!vis[t[x][i]])vis[t[x][i]]=1,q.push(t[x][i]);
107 if(v[t[x][i]])
108 {
109 a.d[x][n]+=tmp;
110 a.d[x][1]+=tmp;
111 }else a.d[x][t[x][i]]+=tmp;
112 }
113 }
114 }
115 inline matrix operator *(matrix &x,matrix &y)
116 {
117 matrix z;
118 for1(i,n)
119 for1(j,n)
120 for1(l,n)
121 z.d[i][j]+=x.d[i][l]*y.d[l][j];
122 return z;
123 }
124 void ksm(int cs)
125 {
126 for(;cs;cs>>=1,a=a*a)
127 if(cs&1)b=b*a;
128 }
129 void printb()
130 {
131 for1(i,n)for1(j,n)cout<<i<<‘ ‘<<j<<‘ ‘<<b.d[i][j]<<endl;
132 }
133 void printa()
134 {
135 for1(i,n)for1(j,n)cout<<i<<‘ ‘<<j<<‘ ‘<<a.d[i][j]<<endl;
136 }
137
138 int main()
139
140 {
141
142 freopen("input.txt","r",stdin);
143
144 freopen("output.txt","w",stdout);
145
146 n=read();m=read();k=read();cnt=1;
147 for1(i,n)add();
148 bfs();
149 n=cnt+1;
150 build();
151 for1(i,n)b.d[i][i]=1;
152 a.d[n][n]=1;
153 ksm(m);
154 printf("%.7f\n",(double)b.d[1][n]);
155
156 return 0;
157
158 }