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