#include <bits/stdc++.h>
const int MAXN = 3005, MAXM = 305;
template <typename _T>
void read(_T &x) {
  x = 0;
  char s = getchar();
  int f = 1;
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + (s - '0'), s = getchar();
  }
  x *= f;
}
template <typename _T>
void write(_T x) {
  if (x < 0) {
    putchar('-');
    x = (~x) + 1;
  }
  if (9 < x) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
double p[MAXN][MAXM];
double f[MAXM][MAXN], delta[MAXM], tmp[MAXN];
int times[MAXM] = {};
int N, M;
void prepare() {
  for (int i = 1; i <= M; i++) f[i][0] = 1.0;
  for (int i = 1; i <= M; i++) {
    for (int j = 1; j <= N; j++) f[i][j] = f[i][j - 1] * (1.0 - p[j][i]);
    delta[i] = 1.0 - f[i][N];
  }
}
void upt(const int indx) {
  times[indx]++;
  if (times[indx] >= N) {
    delta[indx] = 0;
    return;
  }
  for (int i = 0; i <= N; i++) tmp[i] = f[indx][i];
  f[indx][0] = 0.0;
  for (int i = 1; i <= N; i++)
    f[indx][i] = f[indx][i - 1] * (1.0 - p[i][indx]) + tmp[i - 1] * p[i][indx];
  delta[indx] -= f[indx][N];
}
int main() {
  read(N), read(M);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      scanf("%lf", &p[i][j]);
      p[i][j] /= 1000.0;
    }
  }
  prepare();
  double maxVal, res = 0;
  int maxIndx;
  for (int i = 1; i <= N; i++) {
    maxVal = 0, maxIndx = -1;
    for (int j = 1; j <= M; j++) {
      if (maxVal < delta[j]) {
        maxVal = delta[j];
        maxIndx = j;
      }
    }
    res += maxVal;
    if (maxIndx == -1) return 0;
    upt(maxIndx);
  }
  printf("%.12lf\n", res);
  return 0;
}
