#include <bits/stdc++.h>
using namespace std;
int n, m;
int cnt[3005];
double p[3005][3005], f[3005][3005], s1[3005], s2[3005], g[3005], del[3005],
    val[3005];
void update(int x) {
  memcpy(g, f[x], sizeof(g));
  f[x][0] = 0;
  for (int i = 1; i <= n; i++) {
    f[x][i] = f[x][i - 1] * (1 - p[i][x]) + g[i - 1] * p[i][x];
  }
  cnt[x]++;
  s2[x] += f[x][n] * cnt[x];
  s1[x] += f[x][n];
  double t = s2[x] + (1 - s1[x]) * cnt[x];
  del[x] = t - val[x];
  val[x] = t;
}
int main() {
  cin >> n >> m;
  int x;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &x);
      p[i][j] = 1.0 * x / 1000.0;
    }
  }
  for (int i = 1; i <= m; i++) {
    f[i][0] = 1.0;
    for (int j = 1; j <= n; j++) {
      f[i][j] = f[i][j - 1] * (1.0 - p[j][i]);
    }
    s1[i] = f[i][n];
    update(i);
  }
  double ans = 0.0;
  for (int i = 1; i <= n; i++) {
    int id = 0;
    for (int j = 1; j <= m; j++) {
      if (del[id] < del[j]) id = j;
    }
    if (!id) break;
    ans += del[id];
    update(id);
  }
  printf("%.10lf\n", ans);
  return 0;
}
