#include <bits/stdc++.h>
using namespace std;
int nPeople, nTshirt;
double p[301][3001];
vector<double> NULL_VECTOR;
vector<double> FULL_VECTOR;
vector<double> dp[301][3011];
int curTake[301];
double lastProb[301];
void calc(int w) {
  int c = curTake[w];
  dp[w][c + 1] = FULL_VECTOR;
  for (int i = 0; i < nPeople; i++) {
    dp[w][c][i + 1] += dp[w][c][i] * (1.0 - p[w][i + 1]);
    dp[w][c + 1][i + 1] += dp[w][c][i] * p[w][i + 1];
  }
  lastProb[w] -= dp[w][c][nPeople];
  curTake[w]++;
}
int MAIN() {
  while (cin >> nPeople >> nTshirt) {
    for (int i = 1; i <= nTshirt; i++)
      for (int j = 1; j <= nPeople; j++) dp[i][j].clear();
    FULL_VECTOR.clear();
    for (int i = 0; i <= nPeople; i++) FULL_VECTOR.push_back(0.0);
    for (int i = 1; i <= nTshirt; i++) lastProb[i] = 1.0, curTake[i] = 0;
    for (int i = 1; i <= nTshirt; i++) {
      dp[i][0] = FULL_VECTOR;
      dp[i][0][0] = 1.0;
    }
    for (int i = 1; i <= nPeople; i++)
      for (int j = 1; j <= nTshirt; j++) {
        double t;
        cin >> t;
        p[j][i] = t / 1000.0;
      }
    for (int i = 1; i <= nTshirt; i++) calc(i);
    double ans = 0;
    for (int i = 1; i <= nPeople; i++) {
      int choice = 0;
      double bestValue = -1;
      for (int i = 1; i <= nTshirt; i++) {
        if (lastProb[i] > bestValue) {
          bestValue = lastProb[i];
          choice = i;
        }
      }
      ans += lastProb[choice];
      calc(choice);
    }
    cout << ans << endl;
  }
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int RUN_RESULT = MAIN();
  return RUN_RESULT;
}
