#include <bits/stdc++.h>
int n, m;
long double p[3010][310], delta[310], f[310][3010], ans = 0, lastf[3010];
int num[310];
void solve(int cur) {
  num[cur]++;
  if (num[cur] >= n) {
    delta[cur] = 0;
    return;
  }
  memcpy(lastf, f[cur], sizeof(f[cur]));
  f[cur][0] = 0;
  for (int i = 1; i <= n; i++)
    f[cur][i] = f[cur][i - 1] * (1 - p[i][cur]) + lastf[i - 1] * p[i][cur];
  delta[cur] -= f[cur][n];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%Lf", &p[i][j]);
      p[i][j] /= 1000;
    }
  }
  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]);
    delta[i] = 1 - f[i][n];
  }
  for (int i = 1; i <= n; i++) {
    long double mx = 0;
    int k = 0;
    for (int j = 1; j <= m; j++) {
      if (delta[j] > mx) mx = delta[j], k = j;
    }
    ans += mx;
    if (!k) break;
    solve(k);
  }
  printf("%.10Lf\n", ans);
  return 0;
}
