#include <bits/stdc++.h>
using namespace std;
int n, m, now[305];
double cpt[3005][305];
double stf[3005][305], s[3005];
double per[305], rst[305];
priority_queue<pair<double, int> > q;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int a;
      scanf("%d", &a);
      cpt[i][j] = a / 1000.0;
    }
  for (int i = 1; i <= m; i++) stf[0][i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) stf[i][j] = (1 - cpt[i][j]) * stf[i - 1][j];
  for (int i = 1; i <= m; i++) {
    rst[i] = 1 - stf[n][i];
    s[0] = 0;
    for (int j = 1; j <= n; j++)
      s[j] = cpt[j][i] * stf[j - 1][i] + (1 - cpt[j][i]) * s[j - 1];
    for (int j = 0; j <= n; j++) stf[j][i] = s[j];
    q.push(make_pair(rst[i], i));
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    double a = q.top().first;
    int b = q.top().second;
    q.pop();
    ans += a;
    now[b]++;
    rst[b] -= stf[n][b];
    for (int j = 1; j <= n; j++)
      s[j] = cpt[j][b] * stf[j - 1][b] + (1 - cpt[j][b]) * s[j - 1];
    for (int j = 1; j <= n; j++) stf[j][b] = s[j];
    q.push(make_pair(rst[b], b));
  }
  printf("%.12lf\n", ans);
}
