#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int n, m;
double a[3000 + 10][300 + 10], b[3000 + 10], c[3000 + 10], d[3000 + 10],
    f[3000 + 10];
int main() {
  register int i, j, k, l, r, mid;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) {
      scanf("%d", &k);
      a[i][j] = k / 1000.0;
    }
  for (i = 1; i <= m; ++i) {
    memset(b, 0, sizeof b);
    b[0] = 1;
    for (j = 1; j <= n; ++j)
      for (k = j; k >= 0; --k)
        b[k] = b[k] * (1 - a[j][i]) + (k ? b[k - 1] * a[j][i] : 0);
    for (j = 0; j <= n; ++j) {
      c[j] = (j ? c[j - 1] : 0) + b[j];
      d[j] = (j ? d[j - 1] : 0) + b[j] * j;
    }
    for (j = n; j; --j) {
      l = 0, r = j;
      while (l < r) {
        mid = (l + r) >> 1;
        if ((f[j - (mid)] + d[mid] + (mid) * (1 - c[mid])) <
            (f[j - (mid + 1)] + d[mid + 1] + (mid + 1) * (1 - c[mid + 1])))
          l = mid + 1;
        else
          r = mid;
      }
      f[j] = (f[j - (l)] + d[l] + (l) * (1 - c[l]));
    }
  }
  printf("%.10lf\n", f[n]);
  return 0;
}
