#include <bits/stdc++.h>
using namespace std;
long long n, m;
double f[305][3005], g[305], p[3005][305], tmp[3005];
long long num[305];
void inti() {
  scanf("%lld %lld", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      double x;
      scanf("%lf", &x);
      p[i][j] = x / 1000.0;
    }
  for (int i = 1; i <= m; i++) f[i][0] = 1.0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) f[i][j] = f[i][j - 1] * (1 - p[j][i]);
    g[i] = 1 - f[i][n];
  }
  return;
}
void solve(long long x) {
  num[x]++;
  if (num[x] >= n) {
    g[x] = 0;
    return;
  }
  for (int i = 0; i <= n; i++) tmp[i] = f[x][i];
  f[x][0] = 0.0;
  for (int i = 1; i <= n; i++)
    f[x][i] = f[x][i - 1] * (1 - p[i][x]) + tmp[i - 1] * p[i][x];
  g[x] -= f[x][n];
  return;
}
void work() {
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    double Max = 0, id = 0;
    for (int j = 1; j <= m; j++)
      if (Max < g[j]) {
        Max = g[j];
        id = j;
      }
    if (!id) return;
    ans += Max;
    solve(id);
  }
  printf("%.12lf\n", ans);
}
int main() {
  inti();
  work();
}
