#include <bits/stdc++.h>
using namespace std;
int n, m;
long double p[3009][309], delta[309], f[309][3009], Ans = 0.0, last_f[3009],
                                                    number[309];
void work(int now) {
  number[now]++;
  if (number[now] >= n) {
    delta[now] = 0.0;
    return;
  }
  for (int i = 0; i <= n; i++) last_f[i] = f[now][i];
  f[now][0] = 0.0;
  for (int i = 1; i <= n; i++)
    f[now][i] = f[now][i - 1] * (1.0 - p[i][now]) + last_f[i - 1] * p[i][now];
  delta[now] -= f[now][n];
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int x;
      cin >> x;
      p[i][j] = (long double)x / 1000.0;
    }
  for (int i = 1; i <= m; i++) {
    f[i][0] = 1.0;
    for (int j = 1; j <= n; j++) f[i][j] = f[i][j - 1] * (1.0 - p[j][i]);
    delta[i] = 1.0 - f[i][n];
  }
  for (int i = 1; i <= n; i++) {
    long double Max = 0.0;
    int k = 0;
    for (int j = 1; j <= m; j++)
      if (delta[j] > Max) {
        Max = delta[j];
        k = j;
      }
    Ans += Max;
    if (!k) break;
    work(k);
  }
  cout << fixed << setprecision(10) << Ans << endl;
  return 0;
}
