import java.io.*; 

public class ReadMatrix1 {

  static double[][] data;

  public static void main(String[] args) {
    if (args.length > 0) {
      try { 
	FileInputStream in = new FileInputStream(args[0]); 
	int row = readInt(in); 
	System.out.println("row = " + row); 
	int col = readInt(in);
	System.out.println("col = " + col); 
	data = new double[row][col]; 
	for (int i = 0; i < row; i++) {
	  for (int j = 0; j < col; j++) {
	    data[i][j] = readDouble(in); 
	    System.out.println("data[" + i + "][" + j + "] = " + data[i][j]);  
	  }
	}	
      } catch (IOException e) {}  
    }
  }

  public static int readInt(InputStream in) 
      throws IOException {
    byte[] buf = new byte[4];
    in.read(buf); 
    int i = 0; 
    for (int k = 0; k < 4; k++) {
      i <<= 8; 
      i += (((int) buf[k]) & 0xFF); 
    }
    return i; 
  }

  public static double readDouble(InputStream in) 
       throws IOException {
    byte[] buf = new byte[8];
    in.read(buf); 
    long l = 0; 
    for (int k = 0; k < 8; k++) {
      l <<= 8; 
      l += (((int) buf[k]) & 0xFF); 
    }    
    return Double.longBitsToDouble(l); 
  } 
}