#include <bits/stdc++.h>
using namespace std;
const int N = 3010, M = 310;
int n, m;
double p[N][M], f[M][N], delta[M], tmp[N];
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;
    }
  }
  for (int i = 1; i <= m; ++i) {
    f[i][0] = 1;
    for (int j = 1; j <= n; ++j) f[i][j] = f[i][j - 1] * (1 - p[j][i]);
    delta[i] = 1 - f[i][n];
  }
  double ans = 0;
  for (int i = 1; i <= n; ++i) {
    int id = 1;
    for (int j = 1; j <= m; ++j)
      if (delta[j] > delta[id]) id = j;
    ans += delta[id];
    copy(f[id], f[id] + n + 1, tmp);
    f[id][0] = 0;
    for (int j = 1; j <= n; ++j)
      f[id][j] = f[id][j - 1] * (1 - p[j][id]) + tmp[j - 1] * p[j][id];
    delta[id] -= f[id][n];
  }
  printf("%.12lf\n", ans);
}
