#include <bits/stdc++.h>
int n, m, k;
double p[5010][310], c[5010][310];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf("%d", &k);
      p[i][j] = k / 1e3;
    }
  double ans = 0;
  for (int j = 1; j <= m; j++) {
    c[0][j] = 1;
    for (int i = 1; i <= n; i++) c[i][j] = c[i - 1][j] * (1 - p[i][j]);
    for (int i = 0; i <= n; i++) c[i][j] = 1 - c[i][j];
  }
  for (k = 0; k < n; k++) {
    int s = 1;
    for (int j = 2; j <= m; j++)
      if (c[n][j] > c[n][s]) s = j;
    ans += c[n][s];
    double pre = 0;
    for (int i = 1; i <= n; i++) {
      double cur = c[i - 1][s] * (1 - p[i][s]) + pre * p[i][s];
      pre = c[i][s];
      c[i][s] = cur;
    }
  }
  printf("%.10lf", ans);
}
