#include <bits/stdc++.h>
using namespace std;
int n, m;
double p[3005][3005], f[3005][3005], g[3005], t[3005];
double last[3005], gsum[3005], sum[3005], num[3005];
double ans;
void work(int x) {
  ++num[x];
  int i;
  for (i = 0; i <= n; ++i) t[i] = f[x][i];
  f[x][0] = 0.0;
  for (i = 1; i <= n; ++i)
    f[x][i] = f[x][i - 1] * (1 - p[i][x] / 1000) + t[i - 1] * p[i][x] / 1000;
  gsum[x] += f[x][n];
  sum[x] += f[x][n] * num[x];
  double tt = sum[x] + (num[x] + 1) * (1 - gsum[x]);
  g[x] = tt - last[x];
  last[x] = tt;
}
int main() {
  int i, j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) scanf("%lf", &p[i][j]);
  for (i = 1; i <= m; ++i) {
    f[i][0] = 1.0;
    for (j = 1; j <= n; ++j) f[i][j] = f[i][j - 1] * (1 - p[j][i] / 1000);
    gsum[i] = f[i][n];
    last[i] = g[i] = 1.0 - f[i][n];
  }
  for (i = 1; i <= n; ++i) {
    double maxx = 0.0, tmp = 0;
    for (j = 1; j <= m; ++j)
      if (g[j] > maxx) {
        maxx = g[j];
        tmp = j;
      }
    ans += maxx;
    work(tmp);
  }
  printf("%.12lf", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
