#include <bits/stdc++.h>
using namespace std;
long double f[400][3100], p[400][3100], ans;
int n, m, up[400];
void dp(int i) {
  int j;
  long double pre, nw;
  pre = f[i][0];
  f[i][0] = 0;
  for (j = 1; j <= n; j++) {
    nw = f[i][j];
    f[i][j] = pre * p[i][j] + f[i][j - 1] * (1 - p[i][j]);
    pre = nw;
  }
  up[i]++;
}
int main() {
  int i, j, k, x, to;
  long double mx;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      scanf("%d", &x);
      p[j][i] = (long double)x / (long double)1000;
    }
  for (i = 1; i <= m; i++)
    for (j = 0; j <= n; j++) f[i][j] = 1;
  for (i = 1; i <= m; i++) up[i] = 0;
  for (i = 1; i <= m; i++) dp(i);
  ans = 0;
  for (i = 1; i <= n; i++) {
    mx = -1;
    for (j = 1; j <= m; j++)
      if (f[j][n] > mx) mx = f[j][n], to = j;
    ans += mx;
    dp(to);
  }
  double out = ans;
  printf("%.11f\n", out);
  return 0;
}
