#include <bits/stdc++.h>
using namespace std;
int n;
double p[3005][305], f[305][3005], d[305];
inline int read() {
  int re = 0;
  char ch = getchar();
  while (ch < 48 || ch > 57) ch = getchar();
  while (ch > 47 && ch < 58) {
    re = (re << 3) + (re << 1) + (ch ^ 48);
    ch = getchar();
  }
  return re;
}
inline void update(const int x) {
  static double g[3005];
  memcpy(g, f[x], sizeof(double) * (n + 1));
  f[x][0] = 0;
  for (int i = 1; i <= n; ++i)
    f[x][i] = f[x][i - 1] * (1 - p[i][x]) + g[i - 1] * p[i][x];
  d[x] -= f[x][n];
}
int main() {
  int m, t;
  double w = 0;
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < m; ++j) p[i][j] = (double)read() / 1e3;
  for (int i = 0; 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 = 0; i < n; ++i) {
    t = 0;
    for (int j = 1; j < m; ++j)
      if (d[t] < d[j]) t = j;
    w += d[t];
    update(t);
  }
  printf("%.12lf", w);
  return 0;
}
