#include <bits/stdc++.h>
using namespace std;
double p[3001][1001], f[1001][3001], tmp[3001], ans = 0.0;
int n, m;
void Get(int x) {
  for (int j = 0; j <= n; j++) tmp[j] = f[x][j];
  f[x][0] = 0.0;
  for (int j = 1; j <= n; j++)
    f[x][j] = f[x][j - 1] * (1 - p[j][x]) + tmp[j - 1] * p[j][x];
}
int main() {
  scanf("%d %d", &n, &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;
    }
  for (int i = 1; i <= m; Get(i), i++)
    for (int j = 0; j <= n; j++) f[i][j] = 1.0;
  for (int i = 1; i <= n; i++) {
    int tp = 1;
    for (int j = 1; j <= m; j++)
      if (f[j][n] > f[tp][n]) tp = j;
    ans += f[tp][n];
    Get(tp);
  }
  printf("%.9lf\n", ans);
  return 0;
}
