#include using namespace std; #include using namespace atcoder; using ll = int64_t; using ul = uint64_t; using ld = long double; using vi = vector; using vd = vector; using vc = vector; using vs = vector; using vb = vector; using vl = vector; using vvi = vector; using vvd = vector; using vvc = vector; using vvb = vector; using vvl = vector; using mint = modint998244353; using vm = vector; int main() { int N,M; cin >> N >> M; unordered_set b2; ll p = 1; for (int i = 0; i < 50; i++) { b2.insert(p); p *= 2; } vs S(N); vl code(N, 0); for (int i = 0; i < N; i++) { cin >> S[i]; ll power = 1; for (int j = 0; j < M; j++) { if (S[i][j] == 'o') code[i] += power; power *= 2; } } vector dp((1 << N), 0); vi cnt((1 << N), 0); vb end((1 << N), false); for (int i = 1; i < (1 << N); i++) { ll res = -1,power = 1,now = 0; for (int j = 0; j < N; j++) { if ((i & power) > 0) { if (res == -1) res = code[j]; else res = (res & code[j]); now++; } power *= 2; } cnt[i] = now; if (b2.count(res)) end[i] = true; } dp[0] = 1; ld ans = 0; for (int i = 1; i < (1 << N); i++) { ll power = 1; for (int j = 0; j < N; j++) { if ((i & power) == 0) { power *= 2; continue; } if (!end[(i ^ power)]) dp[i] += dp[(i ^ power)]/ld(N - cnt[(i ^ power)]); power *= 2; } if (end[i]) ans += dp[i]*cnt[i]; } cout << fixed << setprecision(9) << ans << endl; return 0; }