#include <bits/stdc++.h>
using namespace std;
int n, m;
double p[3005][305], dp[305][3005], delt[305], ans;
void init() {
  memset(dp, 0, sizeof dp);
  memset(delt, 0, sizeof delt);
  for (int i = 1; i <= m; i++) {
    dp[i][0] = 1.0;
    for (int j = 1; j <= n; j++) {
      dp[i][j] = dp[i][j - 1] * (1.0 - p[j][i]);
    }
    delt[i] = 1.0 - dp[i][n];
  }
}
void Update(int x) {
  double Last[3005] = {};
  swap(Last, dp[x]);
  for (int i = 1; i <= n; i++) {
    dp[x][i] = dp[x][i - 1] * (1.0 - p[i][x]) + Last[i - 1] * p[i][x];
  }
  delt[x] -= dp[x][n];
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      double tmp;
      scanf("%lf", &tmp);
      p[i][j] = tmp / 1000.0;
    }
  }
  ans = 0;
  init();
  for (int i = 1; i <= n; i++) {
    int maxn = 0;
    for (int j = 1; j <= m; j++) {
      if (delt[j] > delt[maxn]) {
        maxn = j;
      }
    }
    ans += delt[maxn];
    Update(maxn);
  }
  printf("%.12lf\n", ans);
  return 0;
}
