#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int N, M;
long double p[maxn][305];
long double g[305][maxn][2];
struct Node {
  int i, k;
  long double va;
  Node(int a = 0, int b = 0, long double c = 0) : i(a), k(b), va(c) {}
  bool operator<(const Node& x) const { return va < x.va; }
};
priority_queue<Node> q;
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1, v; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) {
      scanf("%d", &v);
      p[i][j] = v / 1000.0;
    }
  }
  for (int i = 1; i <= M; ++i) {
    for (int j = 1; j <= N; ++j)
      g[i][j][1] = p[j][i] + (1 - p[j][i]) * g[i][j - 1][1];
    q.push(Node(i, 1, g[i][N][1]));
  }
  long double ans = 0;
  for (int i = 1; i <= N; ++i) {
    Node x = q.top();
    q.pop();
    ans += x.va;
    int la = x.k & 1, k = !la;
    for (int j = 1; j <= N; ++j)
      g[x.i][j][k] = p[j][x.i] * (g[x.i][j - 1][la] + 1) +
                     (1 - p[j][x.i]) * g[x.i][j - 1][k];
    q.push(Node(x.i, x.k + 1, g[x.i][N][k] - g[x.i][N][la]));
  }
  printf("%.15lf\n", (double)ans);
  getchar(), getchar();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
