#include <bits/stdc++.h>
using namespace std;
double f[305][3005], d[305], p[3005][305], tmp[3005], ans;
int cnt[3005];
int main() {
  int n, m, i, j, k, x;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%d", &x);
      p[i][j] = 1.0 * x / 1000.00;
    }
  }
  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]);
    d[i] = 1 - f[i][n];
  }
  for (int i = 1; i <= n; ++i) {
    k = 0;
    for (int j = 1; j <= m; ++j)
      if (d[j] > d[k]) k = j;
    ans += d[k];
    swap(tmp, f[k]);
    f[k][0] = 0;
    for (int j = 1; j <= n; ++j)
      f[k][j] = tmp[j - 1] * p[j][k] + f[k][j - 1] * (1 - p[j][k]);
    d[k] -= f[k][n];
  }
  printf("%.10lf", ans);
}
