#include <bits/stdc++.h>
using namespace std;
const int N = 2222;
const int mod = 1e9 + 7;
int n, m;
int p[3003][303];
long double dp[303][3303];
long double c[3003];
long double ans = 0.0;
long double dd[3303][303];
long double f[3003][303];
long double q[303][3003];
;
long double s[303];
long long cnt[1001];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    int ok = 0;
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &p[i][j]);
      f[i][j] = p[i][j] / (long double)1000.0;
    }
  }
  for (int j = 1; j <= m; ++j) {
    long double fail = 1;
    dp[j][0] = 1;
    for (int i = 1; i <= n; ++i) {
      s[j] += f[i][j] * fail;
      fail *= (1 - f[i][j]);
      fail += dp[j][i];
    }
  }
  for (int i = 1; i <= n; ++i) {
    int id = 1;
    for (int j = 1; j <= m; ++j)
      if (id == -1 || s[j] > s[id]) id = j;
    ans += s[id];
    s[id] = 0;
    long double fail = dp[id][0];
    dp[id][0] = 0;
    memcpy(c, dp[id], sizeof c);
    for (int j = 1; j <= n; ++j) {
      dp[id][j] = f[j][id] * fail;
      fail *= (1 - f[j][id]);
      fail += c[j];
    }
    fail = dp[id][0];
    for (int j = 1; j <= n; ++j) {
      s[id] += f[j][id] * fail;
      fail *= (1 - f[j][id]);
      fail += dp[id][j];
    }
  }
  cout.precision(15);
  cout << ans;
  return 0;
}
