#include <bits/stdc++.h>
const int MAXN = 3005;
const int MAXM = 305;
int n, m;
double p[MAXN][MAXM];
double f[MAXM][MAXN], t[MAXN];
double g[MAXM];
int rd() {
  int x = 0;
  char ch = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x;
}
int main() {
  n = rd(), m = rd();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) p[i][j] = rd() / 1000.0;
  double ans = 0;
  for (int i = 1; i <= m; i++) {
    f[i][0] = 1;
    for (int j = 1; j <= n; j++) f[i][j] = f[i][j - 1] * (1 - p[j][i]);
    g[i] = 1 - f[i][n];
  }
  for (int k = 1; k <= n; k++) {
    double mx = 0;
    int j;
    for (int i = 1; i <= m; i++)
      if (g[i] > mx) mx = g[i], j = i;
    ans += g[j];
    for (int i = 0; i <= n; i++) t[i] = f[j][i];
    f[j][0] = 0;
    for (int i = 1; i <= n; i++)
      f[j][i] = t[i - 1] * p[i][j] + f[j][i - 1] * (1 - p[i][j]);
    g[j] -= f[j][n];
  }
  printf("%.10lf\n", ans);
  return 0;
}
