#include <bits/stdc++.h>
using namespace std;
int Nextint() {
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  int x = 0;
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
const int maxn = 3333;
const int maxm = 333;
double P[maxn][maxm], ans[maxm];
int F[maxm], N, M;
vector<double> V[maxm][maxn];
int main() {
  N = Nextint();
  M = Nextint();
  for (int i = 1; i <= N; i++) {
    double T;
    for (int j = 1; j <= M; j++) {
      scanf("%lf", &T);
      P[i][j] = T / 1000;
    }
  }
  for (int i = 1; i <= M; i++) {
    V[i][0].push_back(1);
    for (int j = 1; j <= N; j++)
      V[i][0].push_back(V[i][0][j - 1] * (1 - P[j][i]));
    ans[i] = 1 - V[i][0][N];
  }
  double Pri = 0;
  for (int i = 1; i <= N; i++) {
    int mx = 1;
    for (int j = 1; j <= M; j++)
      if (ans[j] > ans[mx]) mx = j;
    Pri += ans[mx];
    F[mx]++;
    V[mx][F[mx]].push_back(0);
    for (int j = 1; j <= N; j++)
      V[mx][F[mx]].push_back(V[mx][F[mx]][j - 1] * (1 - P[j][mx]) +
                             V[mx][F[mx] - 1][j - 1] * P[j][mx]);
    ans[mx] -= V[mx][F[mx]][N];
  }
  printf("%.10lf\n", Pri);
  return 0;
}
