#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int n, m, x;
double a[N][N], f[N][N], dp[N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf("%d", &x);
      a[i][j] = (double)x / 1000;
    }
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++)
      f[i][j] = a[j][i] + f[i][j - 1] * (1 - a[j][i]);
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    double Max = f[1][n];
    int id = 1;
    for (int j = 2; j <= m; j++)
      if (Max < f[j][n]) id = j, Max = f[j][n];
    ans += Max;
    for (int j = 1; j <= n; j++)
      dp[j] = a[j][id] * f[id][j - 1] + dp[j - 1] * (1 - a[j][id]);
    for (int j = 1; j <= n; j++) f[id][j] = dp[j];
  }
  printf("%.10lf\n", ans);
  return 0;
}
