#include <bits/stdc++.h>
const int oo = 2139063143;
const int N = 3100;
const int mod = 1000000007;
using namespace std;
inline void sc(int &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
int n, m;
double p[N][N], f[N][N], del[N], last[N];
void update(int w) {
  for (int i = 0; i <= n; i++) last[i] = f[w][i];
  f[w][0] = 0;
  for (int i = 1; i <= n; i++)
    f[w][i] = last[i - 1] * p[i][w] + f[w][i - 1] * (1.0 - p[i][w]);
  del[w] -= f[w][n];
}
int main() {
  sc(n), sc(m);
  int sb;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) sc(sb), p[i][j] = 1.0 * sb / 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.0 - p[j][i]);
    del[i] = 1 - f[i][n];
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    int w = 0;
    for (int j = 1; j <= m; j++)
      if (del[j] > del[w]) w = j;
    ans += del[w];
    update(w);
  }
  printf("%.12lf\n", ans);
  return 0;
}
