#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int N = 3001;
const int M = 301;
int n, m;
double A[N][M];
priority_queue<pair<double, int>> Q;
int C[N];
vector<double> U[M];
vector<double> V[M];
int main() {
  cin >> n >> m;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) {
      int x;
      scanf("%d", &x);
      A[i][j] = x / 1000.0;
    }
  for (int j = (1); j <= (m); j++) {
    U[j].resize(n + 1);
    U[j][1] = A[1][j];
    for (int i = (2); i <= (n); i++)
      U[j][i] = (1 - A[i][j]) * U[j][i - 1] + A[i][j];
    V[j] = U[j];
  }
  for (int j = (1); j <= (m); j++) {
    Q.push({U[j][n], j});
    C[j] = 1;
  }
  int cnt = 0;
  double ans = 0;
  while (cnt < n) {
    auto cur = Q.top();
    ans += cur.first;
    int j = cur.second;
    int num = ++C[j];
    ++cnt;
    Q.pop();
    if (num <= n) {
      for (int i = (1); i <= (n); i++) {
        if (i < num)
          U[j][i] = 0;
        else
          U[j][i] = (1 - A[i][j]) * U[j][i - 1] + A[i][j] * V[j][i - 1];
      }
      V[j] = U[j];
      Q.push({U[j][n], j});
    }
  }
  std::cout << std::setprecision(15) << ans << '\n';
  return 0;
}
