#include <bits/stdc++.h>
#pragma GCC optimize "O3"
using namespace std;
template <class n, class second>
ostream &operator<<(ostream &p, pair<n, second> x) {
  return p << "<" << x.first << ", " << x.second << ">";
}
template <class n>
auto operator<<(ostream &p, n y) ->
    typename enable_if<!is_same<n, string>::value,
                       decltype(y.begin(), p)>::type {
  int o = 0;
  p << "{";
  for (auto c : y) {
    if (o++) p << ", ";
    p << c;
  }
  return p << "}";
}
void dor() { cerr << '\n'; }
template <class n, class... second>
void dor(n p, second... y) {
  cerr << p << " ";
  dor(y...);
}
template <class n, class second>
void mini(n &p, second y) {
  if (p > y) p = y;
}
template <class n, class second>
void maxi(n &p, second y) {
  if (p < y) p = y;
}
const int MXN = 3005;
const int MXM = 3005;
int in[MXN][MXM];
double dp[MXN][MXN];
double probs[MXN];
double results[MXM][MXN];
int mxx[MXM];
int n;
void depe(int res) {
  dp[0][0] = 1;
  double sss = 0;
  for (int i = (1); i <= (int)(n); ++i) sss += probs[i];
  for (int i = (1); i <= (int)(n); ++i) {
    for (int j = (0); j <= (int)(min(i, (int)(sss * 10 + 100))); ++j) {
      dp[i][j] = ((j == 0 ? 0 : dp[i - 1][j - 1]) * probs[i] +
                  dp[i - 1][j] * (1 - probs[i]));
    }
  }
  double sum = 0;
  mxx[res] = n;
  for (int i = (n); i >= (int)(1); --i) {
    sum += dp[n][i];
    results[res][i] = sum;
    if (sum < 1e-18) mxx[res] = i;
    dp[n][i] = 0;
  }
  for (int i = (1); i <= (int)(n); ++i) results[res][i] += results[res][i - 1];
  maxi(mxx[res], min(n, 10));
}
double dp2[MXM][MXN];
int main() {
  ios_base::sync_with_stdio(0);
  int m;
  cin >> n >> m;
  for (int i = (1); i <= (int)(n); ++i) {
    for (int j = (1); j <= (int)(m); ++j) {
      cin >> in[i][j];
    }
  }
  for (int i = (1); i <= (int)(m); ++i) {
    for (int j = (1); j <= (int)(n); ++j) probs[j] = (double)in[j][i] / 1000;
    depe(i);
  }
  dp2[0][0] = 0;
  for (int i = (1); i <= (int)(m); ++i) {
    for (int j = (0); j <= (int)(n); ++j) {
      for (int u = (0); u <= (int)(min(mxx[i], n - j)); ++u) {
        maxi(dp2[i][j + u], dp2[i - 1][j] + results[i][u]);
      }
    }
    for (int j = (1); j <= (int)(n); ++j)
      maxi(dp2[i][j], max(dp2[i - 1][j], dp2[i][j - 1]));
  }
  printf("%.12Lf\n", (long double)dp2[m][n]);
}
