#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3030, MAXM = 303;
priority_queue<pair<double, int> > heap;
double p[MAXN][MAXM], x[MAXM][MAXN], tmp[MAXN];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int x, i = 1; i <= n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", &x), p[i][j] = double(x) / 1000.00;
  for (int j = 0; j < m; ++j) {
    x[j][0] = 0.0;
    for (int i = 1; i <= n; ++i)
      x[j][i] = p[i][j] + x[j][i - 1] * (1.0 - p[i][j]);
    heap.push(make_pair(x[j][n], j));
  }
  double ret = 0.0;
  for (int i = 0; i < n; ++i) {
    int now = heap.top().second;
    heap.pop();
    ret += x[now][n];
    for (int j = 1; j <= n; ++j) tmp[j] = x[now][j], x[now][j] = 0.0;
    tmp[0] = 0.0;
    for (int j = 1; j <= n; ++j)
      x[now][j] = tmp[j - 1] * p[j][now] + (1.0 - p[j][now]) * x[now][j - 1];
    heap.push(make_pair(x[now][n], now));
  }
  printf("%.11lf\n", ret);
  return 0;
}
