#include <bits/stdc++.h>
using namespace std;
const int N = 3005, M = 305;
int n, m;
double po[N][M], totf[M], f[M][N], suf[M][N];
priority_queue<pair<double, int> > que;
inline int rin(int &r) {
  int c = getchar();
  r = 0;
  while (c < '0' || '9' < c) c = getchar();
  while ('0' <= c && c <= '9') r = (r * 10) + (c ^ '0'), c = getchar();
  return r;
}
double update(int id) {
  double ret = 1 - totf[id], tmpsum = f[id][0];
  f[id][0] = 0;
  for (int i = 1; i <= n; i++) {
    double key = f[id][i];
    f[id][i] = tmpsum * po[i][id];
    tmpsum = tmpsum * (1 - po[i][id]) + key;
    totf[id] += f[id][i] * suf[id][i + 1];
  }
  return ret;
}
int main() {
  rin(n), rin(m);
  for (int i = 1; i <= n; i++)
    for (int j = 1, inp; j <= m; j++) po[i][j] = rin(inp) / 1e3;
  for (int i = 1; i <= m; i++) {
    totf[i] = 1;
    suf[i][n + 1] = 1;
    for (int j = n; j; j--) {
      totf[i] *= 1 - po[j][i];
      suf[i][j] = suf[i][j + 1] * (1 - po[j][i]);
    }
    f[i][0] = 1;
    que.push(make_pair(update(i), i));
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    pair<double, int> it = que.top();
    que.pop();
    ans += it.first;
    que.push(make_pair(update(it.second), it.second));
  }
  printf("%.10f\n", ans);
  return 0;
}
