#include <bits/stdc++.h>
using namespace std;
const int N = 320;
struct Node {
  int id;
  double val;
  bool operator<(const Node& A) const { return val < A.val; }
};
priority_queue<Node> q;
unordered_map<int, vector<double> > dp[N];
double p[N * 10][N];
int cnt[N];
double dfs(register int u, register int r, register int pos) {
  if (!r) return 1;
  if (!pos) return 0;
  if (dp[u][r][pos] != -1) return dp[u][r][pos];
  return dp[u][r][pos] = p[pos][u] * dfs(u, r - 1, pos - 1) +
                         (1.0 - p[pos][u]) * dfs(u, r, pos - 1);
}
int main() {
  register int n, m;
  scanf("%d%d", &n, &m);
  for (register int i = 1; i <= n; i++)
    for (register int j = 1; j <= m; j++) {
      scanf("%lf", &p[i][j]);
      p[i][j] /= 1000;
    }
  for (register int i = 1; i <= m; i++) {
    ++cnt[i];
    dp[i][cnt[i]].resize(n + 1, -1);
    q.push((Node){i, dfs(i, cnt[i], n)});
  }
  double res = 0;
  for (register int i = 1; i <= n; i++) {
    Node u = q.top();
    q.pop();
    res += u.val;
    ++cnt[u.id];
    dp[u.id][cnt[u.id]].resize(n + 1, -1);
    q.push((Node){u.id, dfs(u.id, cnt[u.id], n)});
  }
  printf("%.10lf\n", res);
  return 0;
}
