//TLE package no309b; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { public static double solve(int r,int c,double[][] p,int[][] s) { double ans = 0; double[] bef = new double[1<> j) & 1) > 0 ? p[i][j] : (1 - p[i][j]); } for(int m1=0;m1<1<> j & 1) > 0) { point[j] += 4 - s[i][j]; } if ((m1 >> j & 1) > 0) { point[j] += 1; } } for(int j=0;j= 4) { point[j+1]++; } } for(int j=c-1;j>=1;j--) { if (point[j] >= 4) { point[j-1]++; } } int m3 = 0; //この列の手の挙げ方 int count = 0; for(int j=c-1;j>=0;j--) { m3 <<= 1; if (point[j] >= 4) { m3 |= 1; count++; } } now[m3] += bef[m1] * q; ans += bef[m1] * q * count; } } bef = now; } return ans; } public static void main(String[] args) { IO io = new IO(); int r = io.nextInt(); int c = io.nextInt(); double[][] p = new double[r][c]; for(int i=0;i Integer.MAX_VALUE) { throw new NumberFormatException(); } return (int) nl; } public char nextChar() { if (!hasNext()) { throw new NoSuchElementException(); } return (char) readByte(); } public double nextDouble() { return Double.parseDouble(next());} public int[] nextIntArray(int n) { int[] a = new int[n]; for(int i=0;i