#include <bits/stdc++.h>
int n, m, i, j, l;
double s, ans, a[300 + 1][3000 + 1], e[3000 + 1], f[300 + 1][3000 + 1];
struct dat {
  int i;
  double s;
  bool operator<(const dat& p) const { return s < p.s; }
};
std::priority_queue<dat> Q;
int main() {
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) scanf("%lf", &a[j][i]), a[j][i] /= 1000;
  for (i = 1; i <= m; ++i) {
    f[i][0] = 1;
    for (j = 1; j <= n; ++j) f[i][j] = f[i][j - 1] * (1 - a[i][j]);
    Q.push((dat){i, 1 - f[i][n]});
  }
  for (l = 0; l < n; ++l) {
    i = Q.top().i, ans += s = Q.top().s, Q.pop();
    for (j = 0; j <= n; ++j) e[j] = f[i][j];
    f[i][0] = 0;
    for (j = 1; j <= n; ++j)
      f[i][j] = e[j - 1] * a[i][j] + f[i][j - 1] * (1 - a[i][j]);
    Q.push((dat){i, s - f[i][n]});
  }
  printf("%.13f\n", ans);
  return 0;
}
