#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
struct Node {
  int col;
  double val;
  Node() = default;
  bool operator<(const Node &B) const { return val < B.val; }
};
int n, m, tot;
vector<int> f[MAXN];
double g[MAXN][3005], p[3005][305];
priority_queue<Node> q;
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
inline double calc(int i, int k) {
  f[i].push_back(++tot);
  int nxt = f[i][k], pre = f[i][k - 1];
  for (int j = 1; j <= n; j++)
    g[nxt][j] = g[nxt][j - 1] * (1 - p[j][i]) + g[pre][j - 1] * p[j][i];
  double ans = 1;
  for (int j = 0; j < k; j++) ans -= g[f[i][j]][n];
  return ans;
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%lf", &p[i][j]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) p[i][j] /= 1000;
  for (int i = 1; i <= m; i++) f[i].push_back(++tot);
  for (int i = 1; i <= m; i++) {
    g[f[i][0]][0] = 1;
    for (int j = 1; j <= n; j++)
      g[f[i][0]][j] = g[f[i][0]][j - 1] * (1 - p[j][i]);
  }
  for (int i = 1; i <= m; i++) q.push(Node{i, calc(i, f[i].size())});
  int sum = n;
  double ans = 0;
  while (sum--) {
    Node tmp = q.top();
    ans += tmp.val, q.pop();
    q.push(Node{tmp.col, calc(tmp.col, f[tmp.col].size())});
  }
  return printf("%.10lf\n", ans), 0;
}
