#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
double fail[310][3100], p[310][3100], val[310], nf[3100];
int main() {
  int N, M, i, j, u;
  double res;
  scanf("%d%d", &N, &M);
  for (i = 1; i <= N; i++)
    for (j = 1; j <= M; j++) {
      scanf("%lf", &p[j][i]);
      p[j][i] /= 1000;
    }
  for (i = 1; i <= M; i++) {
    fail[i][0] = 1;
    for (j = 1; j <= N; j++) {
      fail[i][j] = fail[i][j - 1] * (1 - p[i][j]);
    }
    val[i] = 1 - fail[i][N];
  }
  res = 0;
  for (i = 1; i <= N; i++) {
    u = max_element(val, val + M + 1) - val;
    res += val[u];
    for (j = 1; j <= N; j++)
      nf[j] = nf[j - 1] * (1 - p[u][j]) + fail[u][j - 1] * p[u][j];
    memcpy(fail[u], nf, sizeof(nf));
    val[u] -= nf[N];
  }
  printf("%.15lf\n", res);
  return 0;
}
