#include <bits/stdc++.h>
using namespace std;
vector<double> dp[305][3005];
double p[305][3005], s[305];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) dp[i][0].push_back(1), s[i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf("%lf", &p[j][i]);
      p[j][i] /= 1000;
    }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++)
      dp[i][j].push_back(dp[i][j - 1].back() * (1 - p[i][j]));
    s[i] -= dp[i][n].back();
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    int pos = -1;
    double Max = -0x3f3f3f3f;
    for (int j = 1; j <= m; j++) {
      double ret = s[j];
      if (ret > Max) {
        Max = ret;
        pos = j;
      }
    }
    ans += Max;
    dp[pos][0].push_back(0);
    for (int j = 1; j <= n; j++)
      dp[pos][j].push_back(dp[pos][j - 1][dp[pos][j - 1].size() - 2] *
                               p[pos][j] +
                           dp[pos][j - 1].back() * (1 - p[pos][j]));
    s[pos] -= dp[pos][n].back();
  }
  printf("%.10lf\n", ans);
}
