#include <bits/stdc++.h>
using namespace std;
enum { MAXM = 310, MAXN = 3100 };
double dp[MAXM][MAXN], prob[MAXM][MAXN], sump[MAXM];
int cuse[MAXM];
void add(int i, int n) {
  cuse[i]++;
  double pv = dp[i][0], cv;
  dp[i][0] = 0;
  for (int j = 1; j <= n; j++) {
    cv = dp[i][j];
    dp[i][j] = prob[i][j] * pv + (1 - prob[i][j]) * dp[i][j - 1];
    pv = cv;
  }
  sump[i] += dp[i][n];
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int j = 1; j <= n; j++) {
    int v;
    for (int i = 0; i < m; i++) {
      scanf("%d", &v);
      prob[i][j] = v / 1e3;
    }
  }
  for (int i = 0; i < m; i++) {
    cuse[i] = 0;
    dp[i][0] = 1;
    for (int j = 1; j <= n; j++) dp[i][j] = dp[i][j - 1] * (1 - prob[i][j]);
    sump[i] = dp[i][n];
  }
  double ans = 0;
  for (int t = 0; t < n; t++) {
    int mp = 0;
    for (int i = 0; i < m; i++)
      if (sump[i] < sump[mp]) mp = i;
    ans += 1 - sump[mp];
    add(mp, n);
  }
  printf("%.10f\n", ans);
  return 0;
}
