#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  double p[m + 1][n + 1], fits[m + 1][n + 1], fits_two_or_more[n + 1];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int t;
      cin >> t;
      p[j][i] = t / 1000.0;
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        fits[j][i] = p[j][i];
        continue;
      }
      fits[j][i] = fits[j][i - 1] + (p[j][i]) * (1 - fits[j][i - 1]);
    }
  }
  double res = 0.0;
  for (int i = 0; i < n; i++) {
    int which_one = 0;
    for (int j = 0; j < m; j++) {
      if (fits[j][n - 1] > fits[which_one][n - 1]) {
        which_one = j;
      }
    }
    res += fits[which_one][n - 1];
    for (int k = 0; k < n; k++) {
      if (k == 0) {
        fits_two_or_more[k] = 0.0;
        continue;
      }
      fits_two_or_more[k] = fits_two_or_more[k - 1] * (1 - p[which_one][k]) +
                            fits[which_one][k - 1] * p[which_one][k];
    }
    for (int k = 0; k < n; k++) {
      fits[which_one][k] = fits_two_or_more[k];
    }
  }
  printf("%.12f", res);
  cin >> n;
  return 0;
}
