#include <bits/stdc++.h>
using namespace std;
const int maxn = 3007;
const int maxm = 307;
double P[maxn][maxm], val[maxm], dp[maxn][maxm];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    int v;
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &v);
      P[i][j] = v / 1000.0;
    }
  }
  double res = 0;
  for (int j = 1; j <= m; ++j) {
    dp[0][j] = 0;
    double sum = 1;
    for (int i = 1; i <= n; ++i) {
      double old = dp[i][j];
      dp[i][j] = sum * P[i][j];
      sum = sum * (1 - P[i][j]) + old;
    }
    val[j] = 0;
    for (int i = 1; i <= n; ++i) val[j] += dp[i][j];
  }
  for (int i = 1; i <= n; ++i) {
    int x = 1;
    for (int j = 2; j <= m; ++j)
      if (val[x] < val[j]) x = j;
    res += val[x];
    double sum = 0;
    for (int i = 1; i <= n; ++i) {
      double old = dp[i][x];
      dp[i][x] = sum * P[i][x];
      sum = sum * (1 - P[i][x]) + old;
    }
    val[x] = 0;
    for (int i = 1; i <= n; ++i) val[x] += dp[i][x];
  }
  printf("%0.9f\n", res);
}
