#include <bits/stdc++.h>
using namespace std;
const int maxn = 3007;
const int maxm = 307;
int mark[maxn][maxn], n, m, cnt;
double p[maxn][maxm], dp[maxn][maxn];
vector<double> res;
double cal(int i, int j) {
  if (j == 0) return 1;
  if (i < j) return 0;
  if (mark[i][j] == cnt) return dp[i][j];
  mark[i][j] = cnt;
  double &res = dp[i][j];
  res = cal(i - 1, j) * (1 - p[i][cnt]);
  if (j > 0) res += cal(i - 1, j - 1) * p[i][cnt];
  return res;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    int v;
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &v);
      p[i][j] = 1.0 * v / 1000;
    }
  }
  memset(mark, 0, sizeof(mark));
  for (int x = 1; x <= m; ++x) {
    cnt = x;
    for (int j = 1; j <= n; ++j) {
      double val = cal(n, j);
      if (val > 1e-9)
        res.push_back(val);
      else
        break;
    }
  }
  sort(res.begin(), res.end(), greater<double>());
  double sum = 0;
  for (int i = 0; i < n; ++i) sum += res[i];
  printf("%0.9f", sum);
}
