#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 2;
const int maxm = 300 + 2;
int n, m;
double ans;
double p[maxm], q[maxn];
double pro[maxm][maxn];
double dp[maxm][maxn];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int x;
      scanf("%d", &x);
      pro[j][i] = x * 0.001;
    }
  for (int i = 1; i <= m; i++) {
    dp[i][0] = 1;
    for (int j = 1; j <= n; j++) dp[i][j] = dp[i][j - 1] * (1 - pro[i][j]);
    p[i] = 1 - dp[i][n];
  }
  for (int i = 1; i <= n; i++) {
    int k = max_element(p, p + m + 1) - p;
    ans += p[k];
    for (int j = 1; j <= n; j++)
      q[j] = q[j - 1] * (1 - pro[k][j]) + dp[k][j - 1] * pro[k][j];
    memcpy(dp[k], q, sizeof(q));
    p[k] -= q[n];
  }
  printf("%.12lf", ans);
  return 0;
}
