balls

Accepts: 3
Submissions: 29
Time Limit: 6000/3000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
Problem Description
There are $n$ balls with $m$ colors. The possibility of that the color of the $i$-th ball is color $j$ is $\frac{a_{i,j}}{a_{i,1}+a_{i,2}+...+a_{i,m}}$. If the number of balls with the $j$-th is $x$, then you should pay $x^2$ as the cost. Please calculate the expectation of the cost.
Input
Several test cases(about $5$) For each cases, first come 2 integers, $n,m(1 \leq n \leq 1000,1 \leq m \leq 1000)$ Then follows $n$ lines with $m$ numbers $a_{i,j} ( 1 \leq a_i \leq 100)$
Output
For each cases, please output the answer with two decimal places.
Sample Input
2 2
1 1
3 5

2 2
4 5
4 2

2 2
2 4
1 4
Sample Output
3.00
2.96
3.20