#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
int n, m;
double p[3030][333], f[333][3030], tmp[3030], ans, d[333];
void calc(int k) {
  swap(tmp, f[k]);
  f[k][0] = 0;
  for (int i = 1; i <= n; ++i)
    f[k][i] = tmp[i - 1] * p[i][k] + f[k][i - 1] * (1 - p[i][k]);
  d[k] -= f[k][n];
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) p[i][j] = read() / 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) {
    int k = 0;
    for (int j = 1; j <= m; ++j)
      if (d[j] > d[k]) k = j;
    ans += d[k];
    calc(k);
  }
  printf("%.10lf\n", ans);
  return 0;
}
