Determines the amount of water a N x M chessboard can hold with each tile having random height