#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 7, M = 3e2 + 7;
int n, m;
long double q[N], ans[M], f[N][M], dp[N][M];
inline int read() {
  int num = 0;
  char g = getchar();
  while (g < 48 || 57 < g) g = getchar();
  while (47 < g && g < 58)
    num = (num << 1) + (num << 3) + g - 48, g = getchar();
  return num;
}
inline void calc(int u) {
  for (int i = 1; i <= n; i++)
    q[i] = dp[i - 1][u] * f[i][u] + q[i - 1] * (1.0 - f[i][u]);
  for (int i = 1; i <= n; i++) dp[i][u] = q[i];
  dp[0][u] = 0;
  ans[u] = ans[u] - dp[n][u];
}
int main() {
  n = read(), m = read();
  long double sum = 0;
  for (int i = 1; i <= n; i++)
    for (int x = 1; x <= m; x++)
      f[i][x] = read() / (long double)(1000.0000000000000000);
  for (int i = 1; i <= m; i++) {
    dp[0][i] = 1;
    for (int x = 1; x <= n; x++) dp[x][i] = dp[x - 1][i] * (1 - f[x][i]);
    ans[i] = 1.0 - dp[n][i];
  }
  for (int i = 1; i <= n; i++) {
    int pot = 1;
    for (int x = 1; x <= m; x++)
      if (ans[pot] < ans[x]) pot = x;
    sum = sum + ans[pot], calc(pot);
  }
  printf("%.10Lf\n", sum);
  return 0;
}
