#include <bits/stdc++.h>
const int N = 3005;
const int M = 305;
double p[N][M], f[M][N], tp[N];
int main() {
  int n, m, i, j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      int x;
      scanf("%d", &x);
      p[i][j] = x / 1000.0;
    }
  }
  for (i = 1; i <= m; i++) {
    f[i][0] = 1.0;
    for (j = 1; j <= n; j++) f[i][j] = f[i][j - 1] * (1.0 - p[j][i]);
    for (j = 0; j <= n; j++) f[i][j] = 1.0 - f[i][j];
  }
  double ret = 0.0;
  for (i = 1; i <= n; i++) {
    int t = 1;
    for (j = 2; j <= m; j++) {
      if (f[t][n] < f[j][n]) t = j;
    }
    ret += f[t][n];
    for (j = 1; j <= n; j++)
      tp[j] = f[t][j - 1] * p[j][t] + tp[j - 1] * (1.0 - p[j][t]);
    for (j = 1; j <= n; j++) f[t][j] = tp[j];
  }
  printf("%.10lf\n", ret);
  return 0;
}
