packages feed

mp3decoder-0.0.1: Codec/Audio/MP3/Tables.hs

--
-- module Tables - Tables defined in the specification.
--
-- This code is part of the Experimental Haskell MP3 Decoder, version 0.0.1.
-- Copyright (c) 2008 Bjorn Edstrom <be@bjrn.se>
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
--    1. The origin of this software must not be misrepresented; you must not
--    claim that you wrote the original software. If you use this software
--    in a product, an acknowledgment in the product documentation would be
--    appreciated but is not required.
--
--    2. Altered source versions must be plainly marked as such, and must not be
--    misrepresented as being the original software.
--
--    3. This notice may not be removed or altered from any source
--    distribution.
--
-- TODO: Change all tables to something more suitable with O(1) lookup.
--
module Codec.Audio.MP3.Tables (
     tableImdctWindow
    ,tableScaleBandBoundary
    ,tableScaleBandIndexLong
    ,tableScaleBandIndexShort
    ,tableSlen
    ,tableReorder
    ,tableReorder2 -- See below.
    ,tablePretab
    ,tableHuffman
    ,tableHuffmanQuad
) where

--
-- tableImdctWindow
--
-- Window coefficients for IMDCT transform.
-- 
tableImdctWindow :: Floating a => Int -> [a]
tableImdctWindow blocktype
    | blocktype == 0   = [coeff n 36 0.5     | n <- [ 0..35]]
    | blocktype == 1   = [coeff n 36 0.5     | n <- [ 0..17]] ++
                         [1.0                | n <- [18..23]] ++
                         [coeff n 12 (-17.5) | n <- [24..29]] ++
                         [0.0                | n <- [30..35]]
    | blocktype == 2   = [coeff n 12 0.5     | n <- [ 0..11]] ++
                         [0.0                | n <- [12..35]]
    | blocktype == 3   = [0.0                | n <- [ 0.. 5]] ++
                         [coeff n 12 (-5.5)  | n <- [ 6..11]] ++
                         [1.0                | n <- [12..17]] ++
                         [coeff n 36 0.5     | n <- [18..35]]
    | otherwise        = error "Wrong blocktype."
    where
        coeff n div' add' = sin (pi/div' * ((fromIntegral n) + add'))

--
-- tableScaleBandBound{Long,Short}, tableScaleBandBoundary
--
-- These few tables represent the boundaries, in the 576 frequency 
-- regions, of the scale factor bands. These bands approximate the
-- critical bands of the human auditory system, and are used to
-- determine scaling. This scaling controls the quantization noise.
--
tableScaleBandBoundLong :: Int -> [Int]
tableScaleBandBoundLong 44100 = [  0,   4,   8,  12,  16,  20,  24,  30,
                                  36,  44,  52,  62,  74,  90, 110, 134, 
                                 162, 196, 238, 288, 342, 418, 576] 
tableScaleBandBoundLong 48000 = [  0,   4,   8,  12,  16,  20,  24,  30, 
                                  36,  42,  50,  60,  72,  88, 106, 128, 
                                 156, 190, 230, 276, 330, 384, 576] 
tableScaleBandBoundLong 32000 = [  0,   4,   8,  12,  16,  20,  24,  30,
                                  36,  44,  54,  66,  82, 102, 126, 156, 
                                 194, 240, 296, 364, 448, 550, 576]
tableScaleBandBoundLong _     = error "Wrong SR for Table."


tableScaleBandBoundShort :: Int -> [Int]
tableScaleBandBoundShort 44100 = [  0,   4,   8,  12,  16,  22,  30,  40, 
                                   52,  66,  84, 106, 136, 192] 
tableScaleBandBoundShort 48000 = [  0,   4,   8,  12,  16,  22,  28,  38, 
                                   50,  64,  80, 100, 126, 192] 
tableScaleBandBoundShort 32000 = [  0,   4,   8,  12,  16,  22,  30,  42, 
                                   58,  78, 104, 138, 180, 192]
tableScaleBandBoundShort _     = error "Wrong SR for Table."

-- We only need to export the long boundaries for unpacking (Unpack.hs).
tableScaleBandBoundary :: Int -> Int -> Int
tableScaleBandBoundary sfreq index = (tableScaleBandBoundLong sfreq) !! index


-- 
-- tableScaleBandIndex{Long,Short}
-- 
-- Long: The scale factor band indices. As the first band has length 4, this
-- gives [0,0,0,0,1,...] which simply means sample 0-3 belong to scale factor
-- band 0.
--
-- Short: The scale factor band indices + 192-granule indices. Due to the
-- encoders reordering, this gives [(0,0),(0,0),(0,0),(0,0),(0,1),...
-- This means sample 0 (of the 576) belongs to scale factor band 0, and the 
-- first of the three 192-granules.
--

tableScaleBandIndexLong :: Int -> [Int]
tableScaleBandIndexLong = indexify . 
                          consecutiveDiff . tableScaleBandBoundLong
  where
    indexify xs = concat (zipWith replicate xs [0..])


tableScaleBandIndexShort :: Int -> [(Int, Int)]
tableScaleBandIndexShort = indexifyWindows . 
                           consecutiveDiff . tableScaleBandBoundShort
  where
    indexifyWindows xs = concat (zipWith addFirst [0..] (map buildTriple xs))
      where
        addFirst n = map (\x -> (n, x))
        buildTriple n = replicate n 0 ++ replicate n 1 ++ replicate n 2


consecutiveDiff :: Num a => [a] -> [a]
consecutiveDiff xs = zipWith (-) (tail xs) xs

-- 
-- tablePretab
--
-- Modifies certain scale factors for higher range than 4 bits.
--
tablePretab :: [Int]
tablePretab = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
               1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0, 0]


--
-- tableSlen
--
-- This table is used for parsing the scale factor bands.
--
tableSlen :: [(Int, Int)]
tableSlen = [(0,0), (0,1), (0,2), (0,3), (3,0), (1,1), (1,2), (1,3),
             (2,1), (2,2), (2,3), (3,1) ,(3,2), (3,3), (4,2), (4,3)] 


-- 
-- tableReorder
--
-- Before Huffman coding the encoder reorders short chunks for better
-- compression. This does two reorderings; see Decoder.hs.
--
tableReorder :: Int -> [Int]
tableReorder 44100 = 
    [ 0,   1,   2,   3,  12,  13,   4,   5,   6,   7,  16,  17,   8,   9,  10,  11,  20,  21,
     14,  15,  24,  25,  26,  27,  18,  19,  28,  29,  30,  31,  22,  23,  32,  33,  34,  35,
     36,  37,  38,  39,  48,  49,  40,  41,  42,  43,  54,  55,  44,  45,  46,  47,  60,  61,
     50,  51,  52,  53,  66,  67,  56,  57,  58,  59,  74,  75,  62,  63,  64,  65,  82,  83,
     68,  69,  70,  71,  72,  73,  76,  77,  78,  79,  80,  81,  84,  85,  86,  87,  88,  89,
     90,  91,  92,  93,  94,  95, 100, 101, 102, 103, 104, 105, 110, 111, 112, 113, 114, 115,
     96,  97,  98,  99, 120, 121, 106, 107, 108, 109, 132, 133, 116, 117, 118, 119, 144, 145,
    122, 123, 124, 125, 126, 127, 134, 135, 136, 137, 138, 139, 146, 147, 148, 149, 150, 151,
    128, 129, 130, 131, 156, 157, 140, 141, 142, 143, 170, 171, 152, 153, 154, 155, 184, 185,
    158, 159, 160, 161, 162, 163, 172, 173, 174, 175, 176, 177, 186, 187, 188, 189, 190, 191,
    164, 165, 166, 167, 168, 169, 178, 179, 180, 181, 182, 183, 192, 193, 194, 195, 196, 197,
    198, 199, 200, 201, 202, 203, 216, 217, 218, 219, 220, 221, 234, 235, 236, 237, 238, 239,
    204, 205, 206, 207, 208, 209, 222, 223, 224, 225, 226, 227, 240, 241, 242, 243, 244, 245,
    210, 211, 212, 213, 214, 215, 228, 229, 230, 231, 232, 233, 246, 247, 248, 249, 250, 251,
    252, 253, 254, 255, 256, 257, 274, 275, 276, 277, 278, 279, 296, 297, 298, 299, 300, 301,
    258, 259, 260, 261, 262, 263, 280, 281, 282, 283, 284, 285, 302, 303, 304, 305, 306, 307,
    264, 265, 266, 267, 268, 269, 286, 287, 288, 289, 290, 291, 308, 309, 310, 311, 312, 313,
    270, 271, 272, 273, 318, 319, 292, 293, 294, 295, 348, 349, 314, 315, 316, 317, 378, 379,
    320, 321, 322, 323, 324, 325, 350, 351, 352, 353, 354, 355, 380, 381, 382, 383, 384, 385,
    326, 327, 328, 329, 330, 331, 356, 357, 358, 359, 360, 361, 386, 387, 388, 389, 390, 391,
    332, 333, 334, 335, 336, 337, 362, 363, 364, 365, 366, 367, 392, 393, 394, 395, 396, 397,
    338, 339, 340, 341, 342, 343, 368, 369, 370, 371, 372, 373, 398, 399, 400, 401, 402, 403,
    344, 345, 346, 347, 408, 409, 374, 375, 376, 377, 464, 465, 404, 405, 406, 407, 520, 521,
    410, 411, 412, 413, 414, 415, 466, 467, 468, 469, 470, 471, 522, 523, 524, 525, 526, 527,
    416, 417, 418, 419, 420, 421, 472, 473, 474, 475, 476, 477, 528, 529, 530, 531, 532, 533,
    422, 423, 424, 425, 426, 427, 478, 479, 480, 481, 482, 483, 534, 535, 536, 537, 538, 539,
    428, 429, 430, 431, 432, 433, 484, 485, 486, 487, 488, 489, 540, 541, 542, 543, 544, 545,
    434, 435, 436, 437, 438, 439, 490, 491, 492, 493, 494, 495, 546, 547, 548, 549, 550, 551,
    440, 441, 442, 443, 444, 445, 496, 497, 498, 499, 500, 501, 552, 553, 554, 555, 556, 557,
    446, 447, 448, 449, 450, 451, 502, 503, 504, 505, 506, 507, 558, 559, 560, 561, 562, 563,
    452, 453, 454, 455, 456, 457, 508, 509, 510, 511, 512, 513, 564, 565, 566, 567, 568, 569,
    458, 459, 460, 461, 462, 463, 514, 515, 516, 517, 518, 519, 570, 571, 572, 573, 574, 575]

tableReorder 48000 = 
    [ 0,   1,   2,   3,  12,  13,   4,   5,   6,   7,  16,  17,   8,   9,  10,  11,  20,  21,
     14,  15,  24,  25,  26,  27,  18,  19,  28,  29,  30,  31,  22,  23,  32,  33,  34,  35,
     36,  37,  38,  39,  48,  49,  40,  41,  42,  43,  54,  55,  44,  45,  46,  47,  60,  61,
     50,  51,  52,  53,  66,  67,  56,  57,  58,  59,  72,  73,  62,  63,  64,  65,  78,  79,
     68,  69,  70,  71,  84,  85,  74,  75,  76,  77,  94,  95,  80,  81,  82,  83, 104, 105,
     86,  87,  88,  89,  90,  91,  96,  97,  98,  99, 100, 101, 106, 107, 108, 109, 110, 111,
     92,  93, 114, 115, 116, 117, 102, 103, 126, 127, 128, 129, 112, 113, 138, 139, 140, 141,
    118, 119, 120, 121, 122, 123, 130, 131, 132, 133, 134, 135, 142, 143, 144, 145, 146, 147,
    124, 125, 150, 151, 152, 153, 136, 137, 164, 165, 166, 167, 148, 149, 178, 179, 180, 181,
    154, 155, 156, 157, 158, 159, 168, 169, 170, 171, 172, 173, 182, 183, 184, 185, 186, 187,
    160, 161, 162, 163, 192, 193, 174, 175, 176, 177, 208, 209, 188, 189, 190, 191, 224, 225,
    194, 195, 196, 197, 198, 199, 210, 211, 212, 213, 214, 215, 226, 227, 228, 229, 230, 231,
    200, 201, 202, 203, 204, 205, 216, 217, 218, 219, 220, 221, 232, 233, 234, 235, 236, 237,
    206, 207, 240, 241, 242, 243, 222, 223, 260, 261, 262, 263, 238, 239, 280, 281, 282, 283,
    244, 245, 246, 247, 248, 249, 264, 265, 266, 267, 268, 269, 284, 285, 286, 287, 288, 289,
    250, 251, 252, 253, 254, 255, 270, 271, 272, 273, 274, 275, 290, 291, 292, 293, 294, 295,
    256, 257, 258, 259, 300, 301, 276, 277, 278, 279, 326, 327, 296, 297, 298, 299, 352, 353,
    302, 303, 304, 305, 306, 307, 328, 329, 330, 331, 332, 333, 354, 355, 356, 357, 358, 359,
    308, 309, 310, 311, 312, 313, 334, 335, 336, 337, 338, 339, 360, 361, 362, 363, 364, 365,
    314, 315, 316, 317, 318, 319, 340, 341, 342, 343, 344, 345, 366, 367, 368, 369, 370, 371,
    320, 321, 322, 323, 324, 325, 346, 347, 348, 349, 350, 351, 372, 373, 374, 375, 376, 377,
    378, 379, 380, 381, 382, 383, 444, 445, 446, 447, 448, 449, 510, 511, 512, 513, 514, 515,
    384, 385, 386, 387, 388, 389, 450, 451, 452, 453, 454, 455, 516, 517, 518, 519, 520, 521,
    390, 391, 392, 393, 394, 395, 456, 457, 458, 459, 460, 461, 522, 523, 524, 525, 526, 527,
    396, 397, 398, 399, 400, 401, 462, 463, 464, 465, 466, 467, 528, 529, 530, 531, 532, 533,
    402, 403, 404, 405, 406, 407, 468, 469, 470, 471, 472, 473, 534, 535, 536, 537, 538, 539,
    408, 409, 410, 411, 412, 413, 474, 475, 476, 477, 478, 479, 540, 541, 542, 543, 544, 545,
    414, 415, 416, 417, 418, 419, 480, 481, 482, 483, 484, 485, 546, 547, 548, 549, 550, 551,
    420, 421, 422, 423, 424, 425, 486, 487, 488, 489, 490, 491, 552, 553, 554, 555, 556, 557,
    426, 427, 428, 429, 430, 431, 492, 493, 494, 495, 496, 497, 558, 559, 560, 561, 562, 563,
    432, 433, 434, 435, 436, 437, 498, 499, 500, 501, 502, 503, 564, 565, 566, 567, 568, 569,
    438, 439, 440, 441, 442, 443, 504, 505, 506, 507, 508, 509, 570, 571, 572, 573, 574, 575]

tableReorder 32000 = 
    [ 0,   1,   2,   3,  12,  13,   4,   5,   6,   7,  16,  17,   8,   9,  10,  11,  20,  21,
     14,  15,  24,  25,  26,  27,  18,  19,  28,  29,  30,  31,  22,  23,  32,  33,  34,  35,
     36,  37,  38,  39,  48,  49,  40,  41,  42,  43,  54,  55,  44,  45,  46,  47,  60,  61,
     50,  51,  52,  53,  66,  67,  56,  57,  58,  59,  74,  75,  62,  63,  64,  65,  82,  83,
     68,  69,  70,  71,  72,  73,  76,  77,  78,  79,  80,  81,  84,  85,  86,  87,  88,  89,
     90,  91,  92,  93,  94,  95, 102, 103, 104, 105, 106, 107, 114, 115, 116, 117, 118, 119,
     96,  97,  98,  99, 100, 101, 108, 109, 110, 111, 112, 113, 120, 121, 122, 123, 124, 125,
    126, 127, 128, 129, 130, 131, 142, 143, 144, 145, 146, 147, 158, 159, 160, 161, 162, 163,
    132, 133, 134, 135, 136, 137, 148, 149, 150, 151, 152, 153, 164, 165, 166, 167, 168, 169,
    138, 139, 140, 141, 174, 175, 154, 155, 156, 157, 194, 195, 170, 171, 172, 173, 214, 215,
    176, 177, 178, 179, 180, 181, 196, 197, 198, 199, 200, 201, 216, 217, 218, 219, 220, 221,
    182, 183, 184, 185, 186, 187, 202, 203, 204, 205, 206, 207, 222, 223, 224, 225, 226, 227,
    188, 189, 190, 191, 192, 193, 208, 209, 210, 211, 212, 213, 228, 229, 230, 231, 232, 233,
    234, 235, 236, 237, 238, 239, 260, 261, 262, 263, 264, 265, 286, 287, 288, 289, 290, 291,
    240, 241, 242, 243, 244, 245, 266, 267, 268, 269, 270, 271, 292, 293, 294, 295, 296, 297,
    246, 247, 248, 249, 250, 251, 272, 273, 274, 275, 276, 277, 298, 299, 300, 301, 302, 303,
    252, 253, 254, 255, 256, 257, 278, 279, 280, 281, 282, 283, 304, 305, 306, 307, 308, 309,
    258, 259, 312, 313, 314, 315, 284, 285, 346, 347, 348, 349, 310, 311, 380, 381, 382, 383,
    316, 317, 318, 319, 320, 321, 350, 351, 352, 353, 354, 355, 384, 385, 386, 387, 388, 389,
    322, 323, 324, 325, 326, 327, 356, 357, 358, 359, 360, 361, 390, 391, 392, 393, 394, 395,
    328, 329, 330, 331, 332, 333, 362, 363, 364, 365, 366, 367, 396, 397, 398, 399, 400, 401,
    334, 335, 336, 337, 338, 339, 368, 369, 370, 371, 372, 373, 402, 403, 404, 405, 406, 407,
    340, 341, 342, 343, 344, 345, 374, 375, 376, 377, 378, 379, 408, 409, 410, 411, 412, 413,
    414, 415, 416, 417, 418, 419, 456, 457, 458, 459, 460, 461, 498, 499, 500, 501, 502, 503,
    420, 421, 422, 423, 424, 425, 462, 463, 464, 465, 466, 467, 504, 505, 506, 507, 508, 509,
    426, 427, 428, 429, 430, 431, 468, 469, 470, 471, 472, 473, 510, 511, 512, 513, 514, 515,
    432, 433, 434, 435, 436, 437, 474, 475, 476, 477, 478, 479, 516, 517, 518, 519, 520, 521,
    438, 439, 440, 441, 442, 443, 480, 481, 482, 483, 484, 485, 522, 523, 524, 525, 526, 527,
    444, 445, 446, 447, 448, 449, 486, 487, 488, 489, 490, 491, 528, 529, 530, 531, 532, 533,
    450, 451, 452, 453, 454, 455, 492, 493, 494, 495, 496, 497, 534, 535, 536, 537, 538, 539,
    540, 541, 542, 543, 544, 545, 552, 553, 554, 555, 556, 557, 564, 565, 566, 567, 568, 569,
    546, 547, 548, 549, 550, 551, 558, 559, 560, 561, 562, 563, 570, 571, 572, 573, 574, 575]

tableReorder _     = error "Wrong SR for Table."

--
-- tableReorder2
--
-- This table does only one reordering. If we do this, we have to
-- imdct 6 [f!!0,f!!3,f!!6,f!!9,f!!12,f!!15] (see Decoder.hs)
--
tableReorder2 :: Int -> [Int]
tableReorder2 44100 = tab1
tableReorder2 48000 = tab2
tableReorder2 32000 = tab3
tableReorder2 _     = error "Wrong SR for Table."

-- The scale factor bandwidth for the first band in a short 192-granule is 4,
-- so the first 12 samples are the first 4 samples, interleaved.
tab1 :: [Int]
tab1 = [0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11,
        12, 16, 20, 13,
        17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32, 25, 29, 33, 26,
        30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45, 38, 42, 46, 39,
        43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
        58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69,
        77, 85, 70, 78, 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,
        100, 110, 91, 101, 111, 92, 102, 112, 93, 103, 113, 94, 104, 114, 95,
        105, 115, 96, 106, 116, 97, 107, 117, 98, 108, 118, 99, 109, 119, 120,
        132, 144, 121, 133, 145, 122, 134, 146, 123, 135, 147, 124, 136, 148, 125,
        137, 149, 126, 138, 150, 127, 139, 151, 128, 140, 152, 129, 141, 153, 130,
        142, 154, 131, 143, 155, 156, 170, 184, 157, 171, 185, 158, 172, 186, 159,
        173, 187, 160, 174, 188, 161, 175, 189, 162, 176, 190, 163, 177, 191, 164,
        178, 192, 165, 179, 193, 166, 180, 194, 167, 181, 195, 168, 182, 196, 169,
        183, 197, 198, 216, 234, 199, 217, 235, 200, 218, 236, 201, 219, 237, 202,
        220, 238, 203, 221, 239, 204, 222, 240, 205, 223, 241, 206, 224, 242, 207,
        225, 243, 208, 226, 244, 209, 227, 245, 210, 228, 246, 211, 229, 247, 212,
        230, 248, 213, 231, 249, 214, 232, 250, 215, 233, 251, 252, 274, 296, 253,
        275, 297, 254, 276, 298, 255, 277, 299, 256, 278, 300, 257, 279, 301, 258,
        280, 302, 259, 281, 303, 260, 282, 304, 261, 283, 305, 262, 284, 306, 263,
        285, 307, 264, 286, 308, 265, 287, 309, 266, 288, 310, 267, 289, 311, 268,
        290, 312, 269, 291, 313, 270, 292, 314, 271, 293, 315, 272, 294, 316, 273,
        295, 317, 318, 348, 378, 319, 349, 379, 320, 350, 380, 321, 351, 381, 322,
        352, 382, 323, 353, 383, 324, 354, 384, 325, 355, 385, 326, 356, 386, 327,
        357, 387, 328, 358, 388, 329, 359, 389, 330, 360, 390, 331, 361, 391, 332,
        362, 392, 333, 363, 393, 334, 364, 394, 335, 365, 395, 336, 366, 396, 337,
        367, 397, 338, 368, 398, 339, 369, 399, 340, 370, 400, 341, 371, 401, 342,
        372, 402, 343, 373, 403, 344, 374, 404, 345, 375, 405, 346, 376, 406, 347,
        377, 407, 408, 464, 520, 409, 465, 521, 410, 466, 522, 411, 467, 523, 412,
        468, 524, 413, 469, 525, 414, 470, 526, 415, 471, 527, 416, 472, 528, 417,
        473, 529, 418, 474, 530, 419, 475, 531, 420, 476, 532, 421, 477, 533, 422,
        478, 534, 423, 479, 535, 424, 480, 536, 425, 481, 537, 426, 482, 538, 427,
        483, 539, 428, 484, 540, 429, 485, 541, 430, 486, 542, 431, 487, 543, 432,
        488, 544, 433, 489, 545, 434, 490, 546, 435, 491, 547, 436, 492, 548, 437,
        493, 549, 438, 494, 550, 439, 495, 551, 440, 496, 552, 441, 497, 553, 442,
        498, 554, 443, 499, 555, 444, 500, 556, 445, 501, 557, 446, 502, 558, 447,
        503, 559, 448, 504, 560, 449, 505, 561, 450, 506, 562, 451, 507, 563, 452,
        508, 564, 453, 509, 565, 454, 510, 566, 455, 511, 567, 456, 512, 568, 457,
        513, 569, 458, 514, 570, 459, 515, 571, 460, 516, 572, 461, 517, 573, 462,
        518, 574, 463, 519, 575]

tab2 :: [Int]
tab2 = [0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13,
        17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32, 25, 29, 33, 26,
        30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45, 38, 42, 46, 39,
        43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
        58, 64, 53, 59, 65, 66, 72, 78, 67, 73, 79, 68, 74, 80, 69,
        75, 81, 70, 76, 82, 71, 77, 83, 84, 94, 104, 85, 95, 105, 86,
        96, 106, 87, 97, 107, 88, 98, 108, 89, 99, 109, 90, 100, 110, 91,
        101, 111, 92, 102, 112, 93, 103, 113, 114, 126, 138, 115, 127, 139, 116,
        128, 140, 117, 129, 141, 118, 130, 142, 119, 131, 143, 120, 132, 144, 121,
        133, 145, 122, 134, 146, 123, 135, 147, 124, 136, 148, 125, 137, 149, 150,
        164, 178, 151, 165, 179, 152, 166, 180, 153, 167, 181, 154, 168, 182, 155,
        169, 183, 156, 170, 184, 157, 171, 185, 158, 172, 186, 159, 173, 187, 160,
        174, 188, 161, 175, 189, 162, 176, 190, 163, 177, 191, 192, 208, 224, 193,
        209, 225, 194, 210, 226, 195, 211, 227, 196, 212, 228, 197, 213, 229, 198,
        214, 230, 199, 215, 231, 200, 216, 232, 201, 217, 233, 202, 218, 234, 203,
        219, 235, 204, 220, 236, 205, 221, 237, 206, 222, 238, 207, 223, 239, 240,
        260, 280, 241, 261, 281, 242, 262, 282, 243, 263, 283, 244, 264, 284, 245,
        265, 285, 246, 266, 286, 247, 267, 287, 248, 268, 288, 249, 269, 289, 250,
        270, 290, 251, 271, 291, 252, 272, 292, 253, 273, 293, 254, 274, 294, 255,
        275, 295, 256, 276, 296, 257, 277, 297, 258, 278, 298, 259, 279, 299, 300,
        326, 352, 301, 327, 353, 302, 328, 354, 303, 329, 355, 304, 330, 356, 305,
        331, 357, 306, 332, 358, 307, 333, 359, 308, 334, 360, 309, 335, 361, 310,
        336, 362, 311, 337, 363, 312, 338, 364, 313, 339, 365, 314, 340, 366, 315,
        341, 367, 316, 342, 368, 317, 343, 369, 318, 344, 370, 319, 345, 371, 320,
        346, 372, 321, 347, 373, 322, 348, 374, 323, 349, 375, 324, 350, 376, 325,
        351, 377, 378, 444, 510, 379, 445, 511, 380, 446, 512, 381, 447, 513, 382,
        448, 514, 383, 449, 515, 384, 450, 516, 385, 451, 517, 386, 452, 518, 387,
        453, 519, 388, 454, 520, 389, 455, 521, 390, 456, 522, 391, 457, 523, 392,
        458, 524, 393, 459, 525, 394, 460, 526, 395, 461, 527, 396, 462, 528, 397,
        463, 529, 398, 464, 530, 399, 465, 531, 400, 466, 532, 401, 467, 533, 402,
        468, 534, 403, 469, 535, 404, 470, 536, 405, 471, 537, 406, 472, 538, 407,
        473, 539, 408, 474, 540, 409, 475, 541, 410, 476, 542, 411, 477, 543, 412,
        478, 544, 413, 479, 545, 414, 480, 546, 415, 481, 547, 416, 482, 548, 417,
        483, 549, 418, 484, 550, 419, 485, 551, 420, 486, 552, 421, 487, 553, 422,
        488, 554, 423, 489, 555, 424, 490, 556, 425, 491, 557, 426, 492, 558, 427,
        493, 559, 428, 494, 560, 429, 495, 561, 430, 496, 562, 431, 497, 563, 432,
        498, 564, 433, 499, 565, 434, 500, 566, 435, 501, 567, 436, 502, 568, 437,
        503, 569, 438, 504, 570, 439, 505, 571, 440, 506, 572, 441, 507, 573, 442,
        508, 574, 443, 509, 575]

tab3 :: [Int]
tab3 =  [0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13,
         17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32, 25, 29, 33, 26,
         30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45, 38, 42, 46, 39,
         43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
         58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69,
         77, 85, 70, 78, 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,
         102, 114, 91, 103, 115, 92, 104, 116, 93, 105, 117, 94, 106, 118, 95,
         107, 119, 96, 108, 120, 97, 109, 121, 98, 110, 122, 99, 111, 123, 100,
         112, 124, 101, 113, 125, 126, 142, 158, 127, 143, 159, 128, 144, 160, 129,
         145, 161, 130, 146, 162, 131, 147, 163, 132, 148, 164, 133, 149, 165, 134,
         150, 166, 135, 151, 167, 136, 152, 168, 137, 153, 169, 138, 154, 170, 139,
         155, 171, 140, 156, 172, 141, 157, 173, 174, 194, 214, 175, 195, 215, 176,
         196, 216, 177, 197, 217, 178, 198, 218, 179, 199, 219, 180, 200, 220, 181,
         201, 221, 182, 202, 222, 183, 203, 223, 184, 204, 224, 185, 205, 225, 186,
         206, 226, 187, 207, 227, 188, 208, 228, 189, 209, 229, 190, 210, 230, 191,
         211, 231, 192, 212, 232, 193, 213, 233, 234, 260, 286, 235, 261, 287, 236,
         262, 288, 237, 263, 289, 238, 264, 290, 239, 265, 291, 240, 266, 292, 241,
         267, 293, 242, 268, 294, 243, 269, 295, 244, 270, 296, 245, 271, 297, 246,
         272, 298, 247, 273, 299, 248, 274, 300, 249, 275, 301, 250, 276, 302, 251,
         277, 303, 252, 278, 304, 253, 279, 305, 254, 280, 306, 255, 281, 307, 256,
         282, 308, 257, 283, 309, 258, 284, 310, 259, 285, 311, 312, 346, 380, 313,
         347, 381, 314, 348, 382, 315, 349, 383, 316, 350, 384, 317, 351, 385, 318,
         352, 386, 319, 353, 387, 320, 354, 388, 321, 355, 389, 322, 356, 390, 323,
         357, 391, 324, 358, 392, 325, 359, 393, 326, 360, 394, 327, 361, 395, 328,
         362, 396, 329, 363, 397, 330, 364, 398, 331, 365, 399, 332, 366, 400, 333,
         367, 401, 334, 368, 402, 335, 369, 403, 336, 370, 404, 337, 371, 405, 338,
         372, 406, 339, 373, 407, 340, 374, 408, 341, 375, 409, 342, 376, 410, 343,
         377, 411, 344, 378, 412, 345, 379, 413, 414, 456, 498, 415, 457, 499, 416,
         458, 500, 417, 459, 501, 418, 460, 502, 419, 461, 503, 420, 462, 504, 421,
         463, 505, 422, 464, 506, 423, 465, 507, 424, 466, 508, 425, 467, 509, 426,
         468, 510, 427, 469, 511, 428, 470, 512, 429, 471, 513, 430, 472, 514, 431,
         473, 515, 432, 474, 516, 433, 475, 517, 434, 476, 518, 435, 477, 519, 436,
         478, 520, 437, 479, 521, 438, 480, 522, 439, 481, 523, 440, 482, 524, 441,
         483, 525, 442, 484, 526, 443, 485, 527, 444, 486, 528, 445, 487, 529, 446,
         488, 530, 447, 489, 531, 448, 490, 532, 449, 491, 533, 450, 492, 534, 451,
         493, 535, 452, 494, 536, 453, 495, 537, 454, 496, 538, 455, 497, 539, 540,
         552, 564, 541, 553, 565, 542, 554, 566, 543, 555, 567, 544, 556, 568, 545,
         557, 569, 546, 558, 570, 547, 559, 571, 548, 560, 572, 549, 561, 573, 550,
         562, 574, 551, 563, 575]


-- 
-- tableHuffmanQuad, tableHuffman
--
-- The Huffman tables and table pairs.
--
tableHuffmanQuad :: [[([Int], (Int, Int, Int, Int))]]
tableHuffmanQuad = [tableHuffRqa, -- 0 
                    tableHuffRqb] -- 1

tableHuffman :: [([([Int], (Int, Int))], Int)]
tableHuffman = [error "Huffman Table 0 does not exist.",
                (tableHuffR00, 0),  -- 1
                (tableHuffR01, 0),  -- 2 
                (tableHuffR02, 0),  -- 3
                error "Huffman Table 4 does not exist.",
                (tableHuffR03, 0),  -- 5
                (tableHuffR04, 0),  -- 6
                (tableHuffR05, 0),  -- 7
                (tableHuffR06, 0),  -- 8
                (tableHuffR07, 0),  -- 9
                (tableHuffR08, 0),  -- 10
                (tableHuffR09, 0),  -- 11
                (tableHuffR10, 0),  -- 12
                (tableHuffR11, 0),  -- 13
                error "Huffman Table 14 does not exist.",
                (tableHuffR12, 0),  -- 15
                (tableHuffR13, 1),  -- 16
                (tableHuffR13, 2),  -- 17
                (tableHuffR13, 3),  -- 18 
                (tableHuffR13, 4),  -- 19
                (tableHuffR13, 6),  -- 20
                (tableHuffR13, 8),  -- 21
                (tableHuffR13, 10), -- 22
                (tableHuffR13, 13), -- 23
                (tableHuffR14, 4),  -- 24
                (tableHuffR14, 5),  -- 25
                (tableHuffR14, 6),  -- 26
                (tableHuffR14, 7),  -- 27
                (tableHuffR14, 8),  -- 28
                (tableHuffR14, 9),  -- 29
                (tableHuffR14, 11), -- 30
                (tableHuffR14, 13)] -- 31


-- Not exported:
tableHuffRqa :: [([Int], (Int, Int, Int, Int))]
tableHuffRqa = [([1],(0,0,0,0)),
                ([0,1,0,1],(0,0,0,1)),
                ([0,1,0,0],(0,0,1,0)),
                ([0,0,1,0,1],(0,0,1,1)),
                ([0,1,1,0],(0,1,0,0)),
                ([0,0,0,1,0,1],(0,1,0,1)),
                ([0,0,1,0,0],(0,1,1,0)),
                ([0,0,0,1,0,0],(0,1,1,1)),
                ([0,1,1,1],(1,0,0,0)),
                ([0,0,0,1,1],(1,0,0,1)),
                ([0,0,1,1,0],(1,0,1,0)),
                ([0,0,0,0,0,0],(1,0,1,1)),
                ([0,0,1,1,1],(1,1,0,0)),
                ([0,0,0,0,1,0],(1,1,0,1)),
                ([0,0,0,0,1,1],(1,1,1,0)),
                ([0,0,0,0,0,1],(1,1,1,1))]

tableHuffRqb :: [([Int], (Int, Int, Int, Int))]
tableHuffRqb = [([1,1,1,1],(0,0,0,0)),
                ([1,1,1,0],(0,0,0,1)),
                ([1,1,0,1],(0,0,1,0)),
                ([1,1,0,0],(0,0,1,1)),
                ([1,0,1,1],(0,1,0,0)),
                ([1,0,1,0],(0,1,0,1)),
                ([1,0,0,1],(0,1,1,0)),
                ([1,0,0,0],(0,1,1,1)),
                ([0,1,1,1],(1,0,0,0)),
                ([0,1,1,0],(1,0,0,1)),
                ([0,1,0,1],(1,0,1,0)),
                ([0,1,0,0],(1,0,1,1)),
                ([0,0,1,1],(1,1,0,0)),
                ([0,0,1,0],(1,1,0,1)),
                ([0,0,0,1],(1,1,1,0)),
                ([0,0,0,0],(1,1,1,1))]

tableHuffR00 :: [([Int], (Int, Int))]
tableHuffR00 = [([1],(0,0)),
                ([0,0,1],(0,1)),
                ([0,1],(1,0)),
                ([0,0,0],(1,1))]

tableHuffR01 :: [([Int], (Int, Int))]
tableHuffR01 = [([1],(0,0)),
                ([0,1,0],(0,1)),
                ([0,0,0,0,0,1],(0,2)),
                ([0,1,1],(1,0)),
                ([0,0,1],(1,1)),
                ([0,0,0,0,1],(1,2)),
                ([0,0,0,1,1],(2,0)),
                ([0,0,0,1,0],(2,1)),
                ([0,0,0,0,0,0],(2,2))]

tableHuffR02 :: [([Int], (Int, Int))]
tableHuffR02 = [([1,1],(0,0)),
                ([1,0],(0,1)),
                ([0,0,0,0,0,1],(0,2)),
                ([0,0,1],(1,0)),
                ([0,1],(1,1)),
                ([0,0,0,0,1],(1,2)),
                ([0,0,0,1,1],(2,0)),
                ([0,0,0,1,0],(2,1)),
                ([0,0,0,0,0,0],(2,2))]

tableHuffR03 :: [([Int], (Int, Int))]
tableHuffR03 = [([1],(0,0)),
                ([0,1,0],(0,1)),
                ([0,0,0,1,1,0],(0,2)),
                ([0,0,0,0,1,0,1],(0,3)),
                ([0,1,1],(1,0)),
                ([0,0,1],(1,1)),
                ([0,0,0,1,0,0],(1,2)),
                ([0,0,0,0,1,0,0],(1,3)),
                ([0,0,0,1,1,1],(2,0)),
                ([0,0,0,1,0,1],(2,1)),
                ([0,0,0,0,1,1,1],(2,2)),
                ([0,0,0,0,0,0,0,1],(2,3)),
                ([0,0,0,0,1,1,0],(3,0)),
                ([0,0,0,0,0,1],(3,1)),
                ([0,0,0,0,0,0,1],(3,2)),
                ([0,0,0,0,0,0,0,0],(3,3))]

tableHuffR04 :: [([Int], (Int, Int))]
tableHuffR04 = [([1,1,1],(0,0)),
                ([0,1,1],(0,1)),
                ([0,0,1,0,1],(0,2)),
                ([0,0,0,0,0,0,1],(0,3)),
                ([1,1,0],(1,0)),
                ([1,0],(1,1)),
                ([0,0,1,1],(1,2)),
                ([0,0,0,1,0],(1,3)),
                ([0,1,0,1],(2,0)),
                ([0,1,0,0],(2,1)),
                ([0,0,1,0,0],(2,2)),
                ([0,0,0,0,0,1],(2,3)),
                ([0,0,0,0,1,1],(3,0)),
                ([0,0,0,1,1],(3,1)),
                ([0,0,0,0,1,0],(3,2)),
                ([0,0,0,0,0,0,0],(3,3))]

tableHuffR05 :: [([Int], (Int, Int))]
tableHuffR05 = [([1],(0,0)),
                ([0,1,0],(0,1)),
                ([0,0,1,0,1,0],(0,2)),
                ([0,0,0,1,0,0,1,1],(0,3)),
                ([0,0,0,1,0,0,0,0],(0,4)),
                ([0,0,0,0,0,1,0,1,0],(0,5)),
                ([0,1,1],(1,0)),
                ([0,0,1,1],(1,1)),
                ([0,0,0,1,1,1],(1,2)),
                ([0,0,0,1,0,1,0],(1,3)),
                ([0,0,0,0,1,0,1],(1,4)),
                ([0,0,0,0,0,0,1,1],(1,5)),
                ([0,0,1,0,1,1],(2,0)),
                ([0,0,1,0,0],(2,1)),
                ([0,0,0,1,1,0,1],(2,2)),
                ([0,0,0,1,0,0,0,1],(2,3)),
                ([0,0,0,0,1,0,0,0],(2,4)),
                ([0,0,0,0,0,0,1,0,0],(2,5)),
                ([0,0,0,1,1,0,0],(3,0)),
                ([0,0,0,1,0,1,1],(3,1)),
                ([0,0,0,1,0,0,1,0],(3,2)),
                ([0,0,0,0,0,1,1,1,1],(3,3)),
                ([0,0,0,0,0,1,0,1,1],(3,4)),
                ([0,0,0,0,0,0,0,1,0],(3,5)),
                ([0,0,0,0,1,1,1],(4,0)),
                ([0,0,0,0,1,1,0],(4,1)),
                ([0,0,0,0,1,0,0,1],(4,2)),
                ([0,0,0,0,0,1,1,1,0],(4,3)),
                ([0,0,0,0,0,0,0,1,1],(4,4)),
                ([0,0,0,0,0,0,0,0,0,1],(4,5)),
                ([0,0,0,0,0,1,1,0],(5,0)),
                ([0,0,0,0,0,1,0,0],(5,1)),
                ([0,0,0,0,0,0,1,0,1],(5,2)),
                ([0,0,0,0,0,0,0,0,1,1],(5,3)),
                ([0,0,0,0,0,0,0,0,1,0],(5,4)),
                ([0,0,0,0,0,0,0,0,0,0],(5,5))]

tableHuffR06 :: [([Int], (Int, Int))]
tableHuffR06 = [([1,1],(0,0)),
                ([1,0,0],(0,1)),
                ([0,0,0,1,1,0],(0,2)),
                ([0,0,0,1,0,0,1,0],(0,3)),
                ([0,0,0,0,1,1,0,0],(0,4)),
                ([0,0,0,0,0,0,1,0,1],(0,5)),
                ([1,0,1],(1,0)),
                ([0,1],(1,1)),
                ([0,0,1,0],(1,2)),
                ([0,0,0,1,0,0,0,0],(1,3)),
                ([0,0,0,0,1,0,0,1],(1,4)),
                ([0,0,0,0,0,0,1,1],(1,5)),
                ([0,0,0,1,1,1],(2,0)),
                ([0,0,1,1],(2,1)),
                ([0,0,0,1,0,1],(2,2)),
                ([0,0,0,0,1,1,1,0],(2,3)),
                ([0,0,0,0,0,1,1,1],(2,4)),
                ([0,0,0,0,0,0,0,1,1],(2,5)),
                ([0,0,0,1,0,0,1,1],(3,0)),
                ([0,0,0,1,0,0,0,1],(3,1)),
                ([0,0,0,0,1,1,1,1],(3,2)),
                ([0,0,0,0,0,1,1,0,1],(3,3)),
                ([0,0,0,0,0,1,0,1,0],(3,4)),
                ([0,0,0,0,0,0,0,1,0,0],(3,5)),
                ([0,0,0,0,1,1,0,1],(4,0)),
                ([0,0,0,0,1,0,1],(4,1)),
                ([0,0,0,0,1,0,0,0],(4,2)),
                ([0,0,0,0,0,1,0,1,1],(4,3)),
                ([0,0,0,0,0,0,0,1,0,1],(4,4)),
                ([0,0,0,0,0,0,0,0,0,1],(4,5)),
                ([0,0,0,0,0,1,1,0,0],(5,0)),
                ([0,0,0,0,0,1,0,0],(5,1)),
                ([0,0,0,0,0,0,1,0,0],(5,2)),
                ([0,0,0,0,0,0,0,0,1],(5,3)),
                ([0,0,0,0,0,0,0,0,0,0,1],(5,4)),
                ([0,0,0,0,0,0,0,0,0,0,0],(5,5))]

tableHuffR07 :: [([Int], (Int, Int))]
tableHuffR07 = [([1,1,1],(0,0)),
                ([1,0,1],(0,1)),
                ([0,1,0,0,1],(0,2)),
                ([0,0,1,1,1,0],(0,3)),
                ([0,0,0,0,1,1,1,1],(0,4)),
                ([0,0,0,0,0,0,1,1,1],(0,5)),
                ([1,1,0],(1,0)),
                ([1,0,0],(1,1)),
                ([0,1,0,1],(1,2)),
                ([0,0,1,0,1],(1,3)),
                ([0,0,0,1,1,0],(1,4)),
                ([0,0,0,0,0,1,1,1],(1,5)),
                ([0,1,1,1],(2,0)),
                ([0,1,1,0],(2,1)),
                ([0,1,0,0,0],(2,2)),
                ([0,0,1,0,0,0],(2,3)),
                ([0,0,0,1,0,0,0],(2,4)),
                ([0,0,0,0,0,1,0,1],(2,5)),
                ([0,0,1,1,1,1],(3,0)),
                ([0,0,1,1,0],(3,1)),
                ([0,0,1,0,0,1],(3,2)),
                ([0,0,0,1,0,1,0],(3,3)),
                ([0,0,0,0,1,0,1],(3,4)),
                ([0,0,0,0,0,0,0,1],(3,5)),
                ([0,0,0,1,0,1,1],(4,0)),
                ([0,0,0,1,1,1],(4,1)),
                ([0,0,0,1,0,0,1],(4,2)),
                ([0,0,0,0,1,1,0],(4,3)),
                ([0,0,0,0,0,1,0,0],(4,4)),
                ([0,0,0,0,0,0,0,0,1],(4,5)),
                ([0,0,0,0,1,1,1,0],(5,0)),
                ([0,0,0,0,1,0,0],(5,1)),
                ([0,0,0,0,0,1,1,0],(5,2)),
                ([0,0,0,0,0,0,1,0],(5,3)),
                ([0,0,0,0,0,0,1,1,0],(5,4)),
                ([0,0,0,0,0,0,0,0,0],(5,5))]

tableHuffR08 :: [([Int], (Int, Int))]
tableHuffR08 = [([1],(0,0)),
                ([0,1,0],(0,1)),
                ([0,0,1,0,1,0],(0,2)),
                ([0,0,0,1,0,1,1,1],(0,3)),
                ([0,0,0,1,0,0,0,1,1],(0,4)),
                ([0,0,0,0,1,1,1,1,0],(0,5)),
                ([0,0,0,0,0,1,1,0,0],(0,6)),
                ([0,0,0,0,0,1,0,0,0,1],(0,7)),
                ([0,1,1],(1,0)),
                ([0,0,1,1],(1,1)),
                ([0,0,1,0,0,0],(1,2)),
                ([0,0,0,1,1,0,0],(1,3)),
                ([0,0,0,1,0,0,1,0],(1,4)),
                ([0,0,0,0,1,0,1,0,1],(1,5)),
                ([0,0,0,0,1,1,0,0],(1,6)),
                ([0,0,0,0,0,1,1,1],(1,7)),
                ([0,0,1,0,1,1],(2,0)),
                ([0,0,1,0,0,1],(2,1)),
                ([0,0,0,1,1,1,1],(2,2)),
                ([0,0,0,1,0,1,0,1],(2,3)),
                ([0,0,0,1,0,0,0,0,0],(2,4)),
                ([0,0,0,0,1,0,1,0,0,0],(2,5)),
                ([0,0,0,0,1,0,0,1,1],(2,6)),
                ([0,0,0,0,0,0,1,1,0],(2,7)),
                ([0,0,0,1,1,1,0],(3,0)),
                ([0,0,0,1,1,0,1],(3,1)),
                ([0,0,0,1,0,1,1,0],(3,2)),
                ([0,0,0,1,0,0,0,1,0],(3,3)),
                ([0,0,0,0,1,0,1,1,1,0],(3,4)),
                ([0,0,0,0,0,1,0,1,1,1],(3,5)),
                ([0,0,0,0,1,0,0,1,0],(3,6)),
                ([0,0,0,0,0,0,0,1,1,1],(3,7)),
                ([0,0,0,1,0,1,0,0],(4,0)),
                ([0,0,0,1,0,0,1,1],(4,1)),
                ([0,0,0,1,0,0,0,0,1],(4,2)),
                ([0,0,0,0,1,0,1,1,1,1],(4,3)),
                ([0,0,0,0,0,1,1,0,1,1],(4,4)),
                ([0,0,0,0,0,1,0,1,1,0],(4,5)),
                ([0,0,0,0,0,0,1,0,0,1],(4,6)),
                ([0,0,0,0,0,0,0,0,1,1],(4,7)),
                ([0,0,0,0,1,1,1,1,1],(5,0)),
                ([0,0,0,0,1,0,1,1,0],(5,1)),
                ([0,0,0,0,1,0,1,0,0,1],(5,2)),
                ([0,0,0,0,0,1,1,0,1,0],(5,3)),
                ([0,0,0,0,0,0,1,0,1,0,1],(5,4)),
                ([0,0,0,0,0,0,1,0,1,0,0],(5,5)),
                ([0,0,0,0,0,0,0,1,0,1],(5,6)),
                ([0,0,0,0,0,0,0,0,0,1,1],(5,7)),
                ([0,0,0,0,1,1,1,0],(6,0)),
                ([0,0,0,0,1,1,0,1],(6,1)),
                ([0,0,0,0,0,1,0,1,0],(6,2)),
                ([0,0,0,0,0,0,1,0,1,1],(6,3)),
                ([0,0,0,0,0,1,0,0,0,0],(6,4)),
                ([0,0,0,0,0,0,0,1,1,0],(6,5)),
                ([0,0,0,0,0,0,0,0,1,0,1],(6,6)),
                ([0,0,0,0,0,0,0,0,0,0,1],(6,7)),
                ([0,0,0,0,0,1,0,0,1],(7,0)),
                ([0,0,0,0,1,0,0,0],(7,1)),
                ([0,0,0,0,0,0,1,1,1],(7,2)),
                ([0,0,0,0,0,0,1,0,0,0],(7,3)),
                ([0,0,0,0,0,0,0,1,0,0],(7,4)),
                ([0,0,0,0,0,0,0,0,1,0,0],(7,5)),
                ([0,0,0,0,0,0,0,0,0,1,0],(7,6)),
                ([0,0,0,0,0,0,0,0,0,0,0],(7,7))]

tableHuffR09 :: [([Int], (Int, Int))]
tableHuffR09 = [([1,1],(0,0)),
                ([1,0,0],(0,1)),
                ([0,1,0,1,0],(0,2)),
                ([0,0,1,1,0,0,0],(0,3)),
                ([0,0,1,0,0,0,1,0],(0,4)),
                ([0,0,0,1,0,0,0,0,1],(0,5)),
                ([0,0,0,1,0,1,0,1],(0,6)),
                ([0,0,0,0,0,1,1,1,1],(0,7)),
                ([1,0,1],(1,0)),
                ([0,1,1],(1,1)),
                ([0,1,0,0],(1,2)),
                ([0,0,1,0,1,0],(1,3)),
                ([0,0,1,0,0,0,0,0],(1,4)),
                ([0,0,0,1,0,0,0,1],(1,5)),
                ([0,0,0,1,0,1,1],(1,6)),
                ([0,0,0,0,1,0,1,0],(1,7)),
                ([0,1,0,1,1],(2,0)),
                ([0,0,1,1,1],(2,1)),
                ([0,0,1,1,0,1],(2,2)),
                ([0,0,1,0,0,1,0],(2,3)),
                ([0,0,0,1,1,1,1,0],(2,4)),
                ([0,0,0,0,1,1,1,1,1],(2,5)),
                ([0,0,0,1,0,1,0,0],(2,6)),
                ([0,0,0,0,0,1,0,1],(2,7)),
                ([0,0,1,1,0,0,1],(3,0)),
                ([0,0,1,0,1,1],(3,1)),
                ([0,0,1,0,0,1,1],(3,2)),
                ([0,0,0,1,1,1,0,1,1],(3,3)),
                ([0,0,0,1,1,0,1,1],(3,4)),
                ([0,0,0,0,0,1,0,0,1,0],(3,5)),
                ([0,0,0,0,1,1,0,0],(3,6)),
                ([0,0,0,0,0,0,1,0,1],(3,7)),
                ([0,0,1,0,0,0,1,1],(4,0)),
                ([0,0,1,0,0,0,0,1],(4,1)),
                ([0,0,0,1,1,1,1,1],(4,2)),
                ([0,0,0,1,1,1,0,1,0],(4,3)),
                ([0,0,0,0,1,1,1,1,0],(4,4)),
                ([0,0,0,0,0,1,0,0,0,0],(4,5)),
                ([0,0,0,0,0,0,1,1,1],(4,6)),
                ([0,0,0,0,0,0,0,1,0,1],(4,7)),
                ([0,0,0,1,1,1,0,0],(5,0)),
                ([0,0,0,1,1,0,1,0],(5,1)),
                ([0,0,0,1,0,0,0,0,0],(5,2)),
                ([0,0,0,0,0,1,0,0,1,1],(5,3)),
                ([0,0,0,0,0,1,0,0,0,1],(5,4)),
                ([0,0,0,0,0,0,0,1,1,1,1],(5,5)),
                ([0,0,0,0,0,0,1,0,0,0],(5,6)),
                ([0,0,0,0,0,0,0,1,1,1,0],(5,7)),
                ([0,0,0,0,1,1,1,0],(6,0)),
                ([0,0,0,1,1,0,0],(6,1)),
                ([0,0,0,1,0,0,1],(6,2)),
                ([0,0,0,0,1,1,0,1],(6,3)),
                ([0,0,0,0,0,1,1,1,0],(6,4)),
                ([0,0,0,0,0,0,1,0,0,1],(6,5)),
                ([0,0,0,0,0,0,0,1,0,0],(6,6)),
                ([0,0,0,0,0,0,0,0,0,1],(6,7)),
                ([0,0,0,0,1,0,1,1],(7,0)),
                ([0,0,0,0,1,0,0],(7,1)),
                ([0,0,0,0,0,1,1,0],(7,2)),
                ([0,0,0,0,0,0,1,1,0],(7,3)),
                ([0,0,0,0,0,0,0,1,1,0],(7,4)),
                ([0,0,0,0,0,0,0,0,1,1],(7,5)),
                ([0,0,0,0,0,0,0,0,1,0],(7,6)),
                ([0,0,0,0,0,0,0,0,0,0],(7,7))]

tableHuffR10 :: [([Int], (Int, Int))]
tableHuffR10 = [([1,0,0,1],(0,0)),
                ([1,1,0],(0,1)),
                ([1,0,0,0,0],(0,2)),
                ([0,1,0,0,0,0,1],(0,3)),
                ([0,0,1,0,1,0,0,1],(0,4)),
                ([0,0,0,1,0,0,1,1,1],(0,5)),
                ([0,0,0,1,0,0,1,1,0],(0,6)),
                ([0,0,0,0,1,1,0,1,0],(0,7)),
                ([1,1,1],(1,0)),
                ([1,0,1],(1,1)),
                ([0,1,1,0],(1,2)),
                ([0,1,0,0,1],(1,3)),
                ([0,0,1,0,1,1,1],(1,4)),
                ([0,0,1,0,0,0,0],(1,5)),
                ([0,0,0,1,1,0,1,0],(1,6)),
                ([0,0,0,0,1,0,1,1],(1,7)),
                ([1,0,0,0,1],(2,0)),
                ([0,1,1,1],(2,1)),
                ([0,1,0,1,1],(2,2)),
                ([0,0,1,1,1,0],(2,3)),
                ([0,0,1,0,1,0,1],(2,4)),
                ([0,0,0,1,1,1,1,0],(2,5)),
                ([0,0,0,1,0,1,0],(2,6)),
                ([0,0,0,0,0,1,1,1],(2,7)),
                ([0,1,0,0,0,1],(3,0)),
                ([0,1,0,1,0],(3,1)),
                ([0,0,1,1,1,1],(3,2)),
                ([0,0,1,1,0,0],(3,3)),
                ([0,0,1,0,0,1,0],(3,4)),
                ([0,0,0,1,1,1,0,0],(3,5)),
                ([0,0,0,0,1,1,1,0],(3,6)),
                ([0,0,0,0,0,1,0,1],(3,7)),
                ([0,1,0,0,0,0,0],(4,0)),
                ([0,0,1,1,0,1],(4,1)),
                ([0,0,1,0,1,1,0],(4,2)),
                ([0,0,1,0,0,1,1],(4,3)),
                ([0,0,0,1,0,0,1,0],(4,4)),
                ([0,0,0,1,0,0,0,0],(4,5)),
                ([0,0,0,0,1,0,0,1],(4,6)),
                ([0,0,0,0,0,0,1,0,1],(4,7)),
                ([0,0,1,0,1,0,0,0],(5,0)),
                ([0,0,1,0,0,0,1],(5,1)),
                ([0,0,0,1,1,1,1,1],(5,2)),
                ([0,0,0,1,1,1,0,1],(5,3)),
                ([0,0,0,1,0,0,0,1],(5,4)),
                ([0,0,0,0,0,1,1,0,1],(5,5)),
                ([0,0,0,0,0,1,0,0],(5,6)),
                ([0,0,0,0,0,0,0,1,0],(5,7)),
                ([0,0,0,1,1,0,1,1],(6,0)),
                ([0,0,0,1,1,0,0],(6,1)),
                ([0,0,0,1,0,1,1],(6,2)),
                ([0,0,0,0,1,1,1,1],(6,3)),
                ([0,0,0,0,1,0,1,0],(6,4)),
                ([0,0,0,0,0,0,1,1,1],(6,5)),
                ([0,0,0,0,0,0,1,0,0],(6,6)),
                ([0,0,0,0,0,0,0,0,0,1],(6,7)),
                ([0,0,0,0,1,1,0,1,1],(7,0)),
                ([0,0,0,0,1,1,0,0],(7,1)),
                ([0,0,0,0,1,0,0,0],(7,2)),
                ([0,0,0,0,0,1,1,0,0],(7,3)),
                ([0,0,0,0,0,0,1,1,0],(7,4)),
                ([0,0,0,0,0,0,0,1,1],(7,5)),
                ([0,0,0,0,0,0,0,0,1],(7,6)),
                ([0,0,0,0,0,0,0,0,0,0],(7,7))]

tableHuffR11 :: [([Int], (Int, Int))]
tableHuffR11 = [([1],(0,0)),
                ([0,1,0,1],(0,1)),
                ([0,0,1,1,1,0],(0,2)),
                ([0,0,1,0,1,0,1],(0,3)),
                ([0,0,1,0,0,0,1,0],(0,4)),
                ([0,0,0,1,1,0,0,1,1],(0,5)),
                ([0,0,0,1,0,1,1,1,0],(0,6)),
                ([0,0,0,1,0,0,0,1,1,1],(0,7)),
                ([0,0,0,1,0,1,0,1,0],(0,8)),
                ([0,0,0,0,1,1,0,1,0,0],(0,9)),
                ([0,0,0,0,1,0,0,0,1,0,0],(0,10)),
                ([0,0,0,0,0,1,1,0,1,0,0],(0,11)),
                ([0,0,0,0,0,1,0,0,0,0,1,1],(0,12)),
                ([0,0,0,0,0,0,1,0,1,1,0,0],(0,13)),
                ([0,0,0,0,0,0,0,1,0,1,0,1,1],(0,14)),
                ([0,0,0,0,0,0,0,0,1,0,0,1,1],(0,15)),
                ([0,1,1],(1,0)),
                ([0,1,0,0],(1,1)),
                ([0,0,1,1,0,0],(1,2)),
                ([0,0,1,0,0,1,1],(1,3)),
                ([0,0,0,1,1,1,1,1],(1,4)),
                ([0,0,0,1,1,0,1,0],(1,5)),
                ([0,0,0,1,0,1,1,0,0],(1,6)),
                ([0,0,0,1,0,0,0,0,1],(1,7)),
                ([0,0,0,0,1,1,1,1,1],(1,8)),
                ([0,0,0,0,1,1,0,0,0],(1,9)),
                ([0,0,0,0,1,0,0,0,0,0],(1,10)),
                ([0,0,0,0,0,1,1,0,0,0],(1,11)),
                ([0,0,0,0,0,0,1,1,1,1,1],(1,12)),
                ([0,0,0,0,0,0,1,0,0,0,1,1],(1,13)),
                ([0,0,0,0,0,0,0,1,0,1,1,0],(1,14)),
                ([0,0,0,0,0,0,0,0,1,1,1,0],(1,15)),
                ([0,0,1,1,1,1],(2,0)),
                ([0,0,1,1,0,1],(2,1)),
                ([0,0,1,0,1,1,1],(2,2)),
                ([0,0,1,0,0,1,0,0],(2,3)),
                ([0,0,0,1,1,1,0,1,1],(2,4)),
                ([0,0,0,1,1,0,0,0,1],(2,5)),
                ([0,0,0,1,0,0,1,1,0,1],(2,6)),
                ([0,0,0,1,0,0,0,0,0,1],(2,7)),
                ([0,0,0,0,1,1,1,0,1],(2,8)),
                ([0,0,0,0,1,0,1,0,0,0],(2,9)),
                ([0,0,0,0,0,1,1,1,1,0],(2,10)),
                ([0,0,0,0,0,1,0,1,0,0,0],(2,11)),
                ([0,0,0,0,0,0,1,1,0,1,1],(2,12)),
                ([0,0,0,0,0,0,1,0,0,0,0,1],(2,13)),
                ([0,0,0,0,0,0,0,1,0,1,0,1,0],(2,14)),
                ([0,0,0,0,0,0,0,0,1,0,0,0,0],(2,15)),
                ([0,0,1,0,1,1,0],(3,0)),
                ([0,0,1,0,1,0,0],(3,1)),
                ([0,0,1,0,0,1,0,1],(3,2)),
                ([0,0,0,1,1,1,1,0,1],(3,3)),
                ([0,0,0,1,1,1,0,0,0],(3,4)),
                ([0,0,0,1,0,0,1,1,1,1],(3,5)),
                ([0,0,0,1,0,0,1,0,0,1],(3,6)),
                ([0,0,0,1,0,0,0,0,0,0],(3,7)),
                ([0,0,0,0,1,0,1,0,1,1],(3,8)),
                ([0,0,0,0,1,0,0,1,1,0,0],(3,9)),
                ([0,0,0,0,0,1,1,1,0,0,0],(3,10)),
                ([0,0,0,0,0,1,0,0,1,0,1],(3,11)),
                ([0,0,0,0,0,0,1,1,0,1,0],(3,12)),
                ([0,0,0,0,0,0,0,1,1,1,1,1],(3,13)),
                ([0,0,0,0,0,0,0,0,1,1,0,0,1],(3,14)),
                ([0,0,0,0,0,0,0,0,0,1,1,1,0],(3,15)),
                ([0,0,1,0,0,0,1,1],(4,0)),
                ([0,0,1,0,0,0,0],(4,1)),
                ([0,0,0,1,1,1,1,0,0],(4,2)),
                ([0,0,0,1,1,1,0,0,1],(4,3)),
                ([0,0,0,1,1,0,0,0,0,1],(4,4)),
                ([0,0,0,1,0,0,1,0,1,1],(4,5)),
                ([0,0,0,0,1,1,1,0,0,1,0],(4,6)),
                ([0,0,0,0,1,0,1,1,0,1,1],(4,7)),
                ([0,0,0,0,1,1,0,1,1,0],(4,8)),
                ([0,0,0,0,1,0,0,1,0,0,1],(4,9)),
                ([0,0,0,0,0,1,1,0,1,1,1],(4,10)),
                ([0,0,0,0,0,0,1,0,1,0,0,1],(4,11)),
                ([0,0,0,0,0,0,1,1,0,0,0,0],(4,12)),
                ([0,0,0,0,0,0,0,1,1,0,1,0,1],(4,13)),
                ([0,0,0,0,0,0,0,0,1,0,1,1,1],(4,14)),
                ([0,0,0,0,0,0,0,0,0,1,1,0,0,0],(4,15)),
                ([0,0,0,1,1,1,0,1,0],(5,0)),
                ([0,0,0,1,1,0,1,1],(5,1)),
                ([0,0,0,1,1,0,0,1,0],(5,2)),
                ([0,0,0,1,1,0,0,0,0,0],(5,3)),
                ([0,0,0,1,0,0,1,1,0,0],(5,4)),
                ([0,0,0,1,0,0,0,1,1,0],(5,5)),
                ([0,0,0,0,1,0,1,1,1,0,1],(5,6)),
                ([0,0,0,0,1,0,1,0,1,0,0],(5,7)),
                ([0,0,0,0,1,0,0,1,1,0,1],(5,8)),
                ([0,0,0,0,0,1,1,1,0,1,0],(5,9)),
                ([0,0,0,0,0,1,0,0,1,1,1,1],(5,10)),
                ([0,0,0,0,0,0,1,1,1,0,1],(5,11)),
                ([0,0,0,0,0,0,1,0,0,1,0,1,0],(5,12)),
                ([0,0,0,0,0,0,0,1,1,0,0,0,1],(5,13)),
                ([0,0,0,0,0,0,0,0,1,0,1,0,0,1],(5,14)),
                ([0,0,0,0,0,0,0,0,0,1,0,0,0,1],(5,15)),
                ([0,0,0,1,0,1,1,1,1],(6,0)),
                ([0,0,0,1,0,1,1,0,1],(6,1)),
                ([0,0,0,1,0,0,1,1,1,0],(6,2)),
                ([0,0,0,1,0,0,1,0,1,0],(6,3)),
                ([0,0,0,0,1,1,1,0,0,1,1],(6,4)),
                ([0,0,0,0,1,0,1,1,1,1,0],(6,5)),
                ([0,0,0,0,1,0,1,1,0,1,0],(6,6)),
                ([0,0,0,0,1,0,0,1,1,1,1],(6,7)),
                ([0,0,0,0,1,0,0,0,1,0,1],(6,8)),
                ([0,0,0,0,0,1,0,1,0,0,1,1],(6,9)),
                ([0,0,0,0,0,1,0,0,0,1,1,1],(6,10)),
                ([0,0,0,0,0,0,1,1,0,0,1,0],(6,11)),
                ([0,0,0,0,0,0,0,1,1,1,0,1,1],(6,12)),
                ([0,0,0,0,0,0,0,1,0,0,1,1,0],(6,13)),
                ([0,0,0,0,0,0,0,0,1,0,0,1,0,0],(6,14)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,1,1],(6,15)),
                ([0,0,0,1,0,0,1,0,0,0],(7,0)),
                ([0,0,0,1,0,0,0,1,0],(7,1)),
                ([0,0,0,0,1,1,1,0,0,0],(7,2)),
                ([0,0,0,0,1,0,1,1,1,1,1],(7,3)),
                ([0,0,0,0,1,0,1,1,1,0,0],(7,4)),
                ([0,0,0,0,1,0,1,0,1,0,1],(7,5)),
                ([0,0,0,0,0,1,0,1,1,0,1,1],(7,6)),
                ([0,0,0,0,0,1,0,1,1,0,1,0],(7,7)),
                ([0,0,0,0,0,1,0,1,0,1,1,0],(7,8)),
                ([0,0,0,0,0,1,0,0,1,0,0,1],(7,9)),
                ([0,0,0,0,0,0,1,0,0,1,1,0,1],(7,10)),
                ([0,0,0,0,0,0,1,0,0,0,0,0,1],(7,11)),
                ([0,0,0,0,0,0,0,1,1,0,0,1,1],(7,12)),
                ([0,0,0,0,0,0,0,0,1,0,1,1,0,0],(7,13)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1],(7,14)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0],(7,15)),
                ([0,0,0,1,0,1,0,1,1],(8,0)),
                ([0,0,0,1,0,1,0,0],(8,1)),
                ([0,0,0,0,1,1,1,1,0],(8,2)),
                ([0,0,0,0,1,0,1,1,0,0],(8,3)),
                ([0,0,0,0,1,1,0,1,1,1],(8,4)),
                ([0,0,0,0,1,0,0,1,1,1,0],(8,5)),
                ([0,0,0,0,1,0,0,1,0,0,0],(8,6)),
                ([0,0,0,0,0,1,0,1,0,1,1,1],(8,7)),
                ([0,0,0,0,0,1,0,0,1,1,1,0],(8,8)),
                ([0,0,0,0,0,0,1,1,1,1,0,1],(8,9)),
                ([0,0,0,0,0,0,1,0,1,1,1,0],(8,10)),
                ([0,0,0,0,0,0,0,1,1,0,1,1,0],(8,11)),
                ([0,0,0,0,0,0,0,1,0,0,1,0,1],(8,12)),
                ([0,0,0,0,0,0,0,0,0,1,1,1,1,0],(8,13)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,1,0,0],(8,14)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],(8,15)),
                ([0,0,0,0,1,1,0,1,0,1],(9,0)),
                ([0,0,0,0,1,1,0,0,1],(9,1)),
                ([0,0,0,0,1,0,1,0,0,1],(9,2)),
                ([0,0,0,0,1,0,0,1,0,1],(9,3)),
                ([0,0,0,0,0,1,0,1,1,0,0],(9,4)),
                ([0,0,0,0,0,1,1,1,0,1,1],(9,5)),
                ([0,0,0,0,0,1,1,0,1,1,0],(9,6)),
                ([0,0,0,0,0,0,1,0,1,0,0,0,1],(9,7)),
                ([0,0,0,0,0,1,0,0,0,0,1,0],(9,8)),
                ([0,0,0,0,0,0,1,0,0,1,1,0,0],(9,9)),
                ([0,0,0,0,0,0,0,1,1,1,0,0,1],(9,10)),
                ([0,0,0,0,0,0,0,0,1,1,0,1,1,0],(9,11)),
                ([0,0,0,0,0,0,0,0,1,0,0,1,0,1],(9,12)),
                ([0,0,0,0,0,0,0,0,0,1,0,0,1,0],(9,13)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1],(9,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,0,1,1],(9,15)),
                ([0,0,0,0,1,0,0,0,1,1],(10,0)),
                ([0,0,0,0,1,0,0,0,0,1],(10,1)),
                ([0,0,0,0,0,1,1,1,1,1],(10,2)),
                ([0,0,0,0,0,1,1,1,0,0,1],(10,3)),
                ([0,0,0,0,0,1,0,1,0,1,0],(10,4)),
                ([0,0,0,0,0,1,0,1,0,0,1,0],(10,5)),
                ([0,0,0,0,0,1,0,0,1,0,0,0],(10,6)),
                ([0,0,0,0,0,0,1,0,1,0,0,0,0],(10,7)),
                ([0,0,0,0,0,0,1,0,1,1,1,1],(10,8)),
                ([0,0,0,0,0,0,0,1,1,1,0,1,0],(10,9)),
                ([0,0,0,0,0,0,0,0,1,1,0,1,1,1],(10,10)),
                ([0,0,0,0,0,0,0,0,1,0,1,0,1],(10,11)),
                ([0,0,0,0,0,0,0,0,0,1,0,1,1,0],(10,12)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,0,1,0],(10,13)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0],(10,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0],(10,15)),
                ([0,0,0,0,0,1,1,0,1,0,1],(11,0)),
                ([0,0,0,0,0,1,1,0,0,1],(11,1)),
                ([0,0,0,0,0,1,0,1,1,1],(11,2)),
                ([0,0,0,0,0,1,0,0,1,1,0],(11,3)),
                ([0,0,0,0,0,1,0,0,0,1,1,0],(11,4)),
                ([0,0,0,0,0,0,1,1,1,1,0,0],(11,5)),
                ([0,0,0,0,0,0,1,1,0,0,1,1],(11,6)),
                ([0,0,0,0,0,0,1,0,0,1,0,0],(11,7)),
                ([0,0,0,0,0,0,0,1,1,0,1,1,1],(11,8)),
                ([0,0,0,0,0,0,0,0,1,1,0,1,0],(11,9)),
                ([0,0,0,0,0,0,0,1,0,0,0,1,0],(11,10)),
                ([0,0,0,0,0,0,0,0,0,1,0,1,1,1],(11,11)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,0,1,1],(11,12)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,1,1,0],(11,13)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,0,0,1],(11,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1],(11,15)),
                ([0,0,0,0,0,1,0,0,0,1,0],(12,0)),
                ([0,0,0,0,0,1,0,0,0,0,0],(12,1)),
                ([0,0,0,0,0,0,1,1,1,0,0],(12,2)),
                ([0,0,0,0,0,0,1,0,0,1,1,1],(12,3)),
                ([0,0,0,0,0,0,1,1,0,0,0,1],(12,4)),
                ([0,0,0,0,0,0,1,0,0,1,0,1,1],(12,5)),
                ([0,0,0,0,0,0,0,1,1,1,1,0],(12,6)),
                ([0,0,0,0,0,0,0,1,1,0,1,0,0],(12,7)),
                ([0,0,0,0,0,0,0,0,1,1,0,0,0,0],(12,8)),
                ([0,0,0,0,0,0,0,0,1,0,1,0,0,0],(12,9)),
                ([0,0,0,0,0,0,0,0,0,1,1,0,1,0,0],(12,10)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,1,0,0],(12,11)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,0,1,0],(12,12)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1],(12,13)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1],(12,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1],(12,15)),
                ([0,0,0,0,0,0,1,0,1,1,0,1],(13,0)),
                ([0,0,0,0,0,0,1,0,1,0,1],(13,1)),
                ([0,0,0,0,0,0,1,0,0,0,1,0],(13,2)),
                ([0,0,0,0,0,0,1,0,0,0,0,0,0],(13,3)),
                ([0,0,0,0,0,0,0,1,1,1,0,0,0],(13,4)),
                ([0,0,0,0,0,0,0,1,1,0,0,1,0],(13,5)),
                ([0,0,0,0,0,0,0,0,1,1,0,0,0,1],(13,6)),
                ([0,0,0,0,0,0,0,0,1,0,1,1,0,1],(13,7)),
                ([0,0,0,0,0,0,0,0,0,1,1,1,1,1],(13,8)),
                ([0,0,0,0,0,0,0,0,0,1,0,0,1,1],(13,9)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,0,0],(13,10)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,1,1,1],(13,11)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0],(13,12)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1],(13,13)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0],(13,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1],(13,15)),
                ([0,0,0,0,0,0,0,1,1,0,0,0,0],(14,0)),
                ([0,0,0,0,0,0,0,1,0,1,1,1],(14,1)),
                ([0,0,0,0,0,0,0,1,0,1,0,0],(14,2)),
                ([0,0,0,0,0,0,0,1,0,0,1,1,1],(14,3)),
                ([0,0,0,0,0,0,0,1,0,0,1,0,0],(14,4)),
                ([0,0,0,0,0,0,0,1,0,0,0,1,1],(14,5)),
                ([0,0,0,0,0,0,0,0,0,1,1,0,1,0,1],(14,6)),
                ([0,0,0,0,0,0,0,0,0,1,0,1,0,1],(14,7)),
                ([0,0,0,0,0,0,0,0,0,1,0,0,0,0],(14,8)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1],(14,9)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,1,0,1],(14,10)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,0,1,0],(14,11)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1,1,0],(14,12)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],(14,13)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0],(14,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],(14,15)),
                ([0,0,0,0,0,0,0,1,0,0,0,0],(15,0)),
                ([0,0,0,0,0,0,0,0,1,1,1,1],(15,1)),
                ([0,0,0,0,0,0,0,0,1,0,0,0,1],(15,2)),
                ([0,0,0,0,0,0,0,0,0,1,1,0,1,1],(15,3)),
                ([0,0,0,0,0,0,0,0,0,1,1,0,0,1],(15,4)),
                ([0,0,0,0,0,0,0,0,0,1,0,1,0,0],(15,5)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,1,0,1],(15,6)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,1,1],(15,7)),
                ([0,0,0,0,0,0,0,0,0,0,1,0,0,0,1],(15,8)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,1,0,0],(15,9)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],(15,10)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0],(15,11)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],(15,12)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],(15,13)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],(15,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],(15,15))]

tableHuffR12 :: [([Int], (Int, Int))]
tableHuffR12 = [([1,1,1],(0,0)),
                ([1,1,0,0],(0,1)),
                ([1,0,0,1,0],(0,2)),
                ([0,1,1,0,1,0,1],(0,3)),
                ([0,1,0,1,1,1,1],(0,4)),
                ([0,1,0,0,1,1,0,0],(0,5)),
                ([0,0,1,1,1,1,1,0,0],(0,6)),
                ([0,0,1,1,0,1,1,0,0],(0,7)),
                ([0,0,1,0,1,1,0,0,1],(0,8)),
                ([0,0,0,1,1,1,1,0,1,1],(0,9)),
                ([0,0,0,1,1,0,1,1,0,0],(0,10)),
                ([0,0,0,0,1,1,1,0,1,1,1],(0,11)),
                ([0,0,0,0,1,1,0,1,0,1,1],(0,12)),
                ([0,0,0,0,1,0,1,0,0,0,1],(0,13)),
                ([0,0,0,0,0,1,1,1,1,0,1,0],(0,14)),
                ([0,0,0,0,0,0,0,1,1,1,1,1,1],(0,15)),
                ([1,1,0,1],(1,0)),
                ([1,0,1],(1,1)),
                ([1,0,0,0,0],(1,2)),
                ([0,1,1,0,1,1],(1,3)),
                ([0,1,0,1,1,1,0],(1,4)),
                ([0,1,0,0,1,0,0],(1,5)),
                ([0,0,1,1,1,1,0,1],(1,6)),
                ([0,0,1,1,0,0,1,1],(1,7)),
                ([0,0,1,0,1,0,1,0],(1,8)),
                ([0,0,1,0,0,0,1,1,0],(1,9)),
                ([0,0,0,1,1,0,1,0,0],(1,10)),
                ([0,0,0,1,0,1,0,0,1,1],(1,11)),
                ([0,0,0,1,0,0,0,0,0,1],(1,12)),
                ([0,0,0,0,1,0,1,0,0,1],(1,13)),
                ([0,0,0,0,0,1,1,1,0,1,1],(1,14)),
                ([0,0,0,0,0,1,0,0,1,0,0],(1,15)),
                ([1,0,0,1,1],(2,0)),
                ([1,0,0,0,1],(2,1)),
                ([0,1,1,1,1],(2,2)),
                ([0,1,1,0,0,0],(2,3)),
                ([0,1,0,1,0,0,1],(2,4)),
                ([0,1,0,0,0,1,0],(2,5)),
                ([0,0,1,1,1,0,1,1],(2,6)),
                ([0,0,1,1,0,0,0,0],(2,7)),
                ([0,0,1,0,1,0,0,0],(2,8)),
                ([0,0,1,0,0,0,0,0,0],(2,9)),
                ([0,0,0,1,1,0,0,1,0],(2,10)),
                ([0,0,0,1,0,0,1,1,1,0],(2,11)),
                ([0,0,0,0,1,1,1,1,1,0],(2,12)),
                ([0,0,0,0,1,0,1,0,0,0,0],(2,13)),
                ([0,0,0,0,0,1,1,1,0,0,0],(2,14)),
                ([0,0,0,0,0,1,0,0,0,0,1],(2,15)),
                ([0,1,1,1,0,1],(3,0)),
                ([0,1,1,1,0,0],(3,1)),
                ([0,1,1,0,0,1],(3,2)),
                ([0,1,0,1,0,1,1],(3,3)),
                ([0,1,0,0,1,1,1],(3,4)),
                ([0,0,1,1,1,1,1,1],(3,5)),
                ([0,0,1,1,0,1,1,1],(3,6)),
                ([0,0,1,0,1,1,1,0,1],(3,7)),
                ([0,0,1,0,0,1,1,0,0],(3,8)),
                ([0,0,0,1,1,1,0,1,1],(3,9)),
                ([0,0,0,1,0,1,1,1,0,1],(3,10)),
                ([0,0,0,1,0,0,1,0,0,0],(3,11)),
                ([0,0,0,0,1,1,0,1,1,0],(3,12)),
                ([0,0,0,0,1,0,0,1,0,1,1],(3,13)),
                ([0,0,0,0,0,1,1,0,0,1,0],(3,14)),
                ([0,0,0,0,0,0,1,1,1,0,1],(3,15)),
                ([0,1,1,0,1,0,0],(4,0)),
                ([0,1,0,1,1,0],(4,1)),
                ([0,1,0,1,0,1,0],(4,2)),
                ([0,1,0,1,0,0,0],(4,3)),
                ([0,1,0,0,0,0,1,1],(4,4)),
                ([0,0,1,1,1,0,0,1],(4,5)),
                ([0,0,1,0,1,1,1,1,1],(4,6)),
                ([0,0,1,0,0,1,1,1,1],(4,7)),
                ([0,0,1,0,0,1,0,0,0],(4,8)),
                ([0,0,0,1,1,1,0,0,1],(4,9)),
                ([0,0,0,1,0,1,1,0,0,1],(4,10)),
                ([0,0,0,1,0,0,0,1,0,1],(4,11)),
                ([0,0,0,0,1,1,0,0,0,1],(4,12)),
                ([0,0,0,0,1,0,0,0,0,1,0],(4,13)),
                ([0,0,0,0,0,1,0,1,1,1,0],(4,14)),
                ([0,0,0,0,0,0,1,1,0,1,1],(4,15)),
                ([0,1,0,0,1,1,0,1],(5,0)),
                ([0,1,0,0,1,0,1],(5,1)),
                ([0,1,0,0,0,1,1],(5,2)),
                ([0,1,0,0,0,0,1,0],(5,3)),
                ([0,0,1,1,1,0,1,0],(5,4)),
                ([0,0,1,1,0,1,0,0],(5,5)),
                ([0,0,1,0,1,1,0,1,1],(5,6)),
                ([0,0,1,0,0,1,0,1,0],(5,7)),
                ([0,0,0,1,1,1,1,1,0],(5,8)),
                ([0,0,0,1,1,0,0,0,0],(5,9)),
                ([0,0,0,1,0,0,1,1,1,1],(5,10)),
                ([0,0,0,0,1,1,1,1,1,1],(5,11)),
                ([0,0,0,0,1,0,1,1,0,1,0],(5,12)),
                ([0,0,0,0,0,1,1,1,1,1,0],(5,13)),
                ([0,0,0,0,0,1,0,1,0,0,0],(5,14)),
                ([0,0,0,0,0,0,1,0,0,1,1,0],(5,15)),
                ([0,0,1,1,1,1,1,0,1],(6,0)),
                ([0,1,0,0,0,0,0],(6,1)),
                ([0,0,1,1,1,1,0,0],(6,2)),
                ([0,0,1,1,1,0,0,0],(6,3)),
                ([0,0,1,1,0,0,1,0],(6,4)),
                ([0,0,1,0,1,1,1,0,0],(6,5)),
                ([0,0,1,0,0,1,1,1,0],(6,6)),
                ([0,0,1,0,0,0,0,0,1],(6,7)),
                ([0,0,0,1,1,0,1,1,1],(6,8)),
                ([0,0,0,1,0,1,0,1,1,1],(6,9)),
                ([0,0,0,1,0,0,0,1,1,1],(6,10)),
                ([0,0,0,0,1,1,0,0,1,1],(6,11)),
                ([0,0,0,0,1,0,0,1,0,0,1],(6,12)),
                ([0,0,0,0,0,1,1,0,0,1,1],(6,13)),
                ([0,0,0,0,0,1,0,0,0,1,1,0],(6,14)),
                ([0,0,0,0,0,0,0,1,1,1,1,0],(6,15)),
                ([0,0,1,1,0,1,1,0,1],(7,0)),
                ([0,0,1,1,0,1,0,1],(7,1)),
                ([0,0,1,1,0,0,0,1],(7,2)),
                ([0,0,1,0,1,1,1,1,0],(7,3)),
                ([0,0,1,0,1,1,0,0,0],(7,4)),
                ([0,0,1,0,0,1,0,1,1],(7,5)),
                ([0,0,1,0,0,0,0,1,0],(7,6)),
                ([0,0,0,1,1,1,1,0,1,0],(7,7)),
                ([0,0,0,1,0,1,1,0,1,1],(7,8)),
                ([0,0,0,1,0,0,1,0,0,1],(7,9)),
                ([0,0,0,0,1,1,1,0,0,0],(7,10)),
                ([0,0,0,0,1,0,1,0,1,0],(7,11)),
                ([0,0,0,0,1,0,0,0,0,0,0],(7,12)),
                ([0,0,0,0,0,1,0,1,1,0,0],(7,13)),
                ([0,0,0,0,0,0,1,0,1,0,1],(7,14)),
                ([0,0,0,0,0,0,0,1,1,0,0,1],(7,15)),
                ([0,0,1,0,1,1,0,1,0],(8,0)),
                ([0,0,1,0,1,0,1,1],(8,1)),
                ([0,0,1,0,1,0,0,1],(8,2)),
                ([0,0,1,0,0,1,1,0,1],(8,3)),
                ([0,0,1,0,0,1,0,0,1],(8,4)),
                ([0,0,0,1,1,1,1,1,1],(8,5)),
                ([0,0,0,1,1,1,0,0,0],(8,6)),
                ([0,0,0,1,0,1,1,1,0,0],(8,7)),
                ([0,0,0,1,0,0,1,1,0,1],(8,8)),
                ([0,0,0,1,0,0,0,0,1,0],(8,9)),
                ([0,0,0,0,1,0,1,1,1,1],(8,10)),
                ([0,0,0,0,1,0,0,0,0,1,1],(8,11)),
                ([0,0,0,0,0,1,1,0,0,0,0],(8,12)),
                ([0,0,0,0,0,0,1,1,0,1,0,1],(8,13)),
                ([0,0,0,0,0,0,1,0,0,1,0,0],(8,14)),
                ([0,0,0,0,0,0,0,1,0,1,0,0],(8,15)),
                ([0,0,1,0,0,0,1,1,1],(9,0)),
                ([0,0,1,0,0,0,1,0],(9,1)),
                ([0,0,1,0,0,0,0,1,1],(9,2)),
                ([0,0,0,1,1,1,1,0,0],(9,3)),
                ([0,0,0,1,1,1,0,1,0],(9,4)),
                ([0,0,0,1,1,0,0,0,1],(9,5)),
                ([0,0,0,1,0,1,1,0,0,0],(9,6)),
                ([0,0,0,1,0,0,1,1,0,0],(9,7)),
                ([0,0,0,1,0,0,0,0,1,1],(9,8)),
                ([0,0,0,0,1,1,0,1,0,1,0],(9,9)),
                ([0,0,0,0,1,0,0,0,1,1,1],(9,10)),
                ([0,0,0,0,0,1,1,0,1,1,0],(9,11)),
                ([0,0,0,0,0,1,0,0,1,1,0],(9,12)),
                ([0,0,0,0,0,0,1,0,0,1,1,1],(9,13)),
                ([0,0,0,0,0,0,0,1,0,1,1,1],(9,14)),
                ([0,0,0,0,0,0,0,0,1,1,1,1],(9,15)),
                ([0,0,0,1,1,0,1,1,0,1],(10,0)),
                ([0,0,0,1,1,0,1,0,1],(10,1)),
                ([0,0,0,1,1,0,0,1,1],(10,2)),
                ([0,0,0,1,0,1,1,1,1],(10,3)),
                ([0,0,0,1,0,1,1,0,1,0],(10,4)),
                ([0,0,0,1,0,1,0,0,1,0],(10,5)),
                ([0,0,0,0,1,1,1,0,1,0],(10,6)),
                ([0,0,0,0,1,1,1,0,0,1],(10,7)),
                ([0,0,0,0,1,1,0,0,0,0],(10,8)),
                ([0,0,0,0,1,0,0,1,0,0,0],(10,9)),
                ([0,0,0,0,0,1,1,1,0,0,1],(10,10)),
                ([0,0,0,0,0,1,0,1,0,0,1],(10,11)),
                ([0,0,0,0,0,0,1,0,1,1,1],(10,12)),
                ([0,0,0,0,0,0,0,1,1,0,1,1],(10,13)),
                ([0,0,0,0,0,0,0,1,1,1,1,1,0],(10,14)),
                ([0,0,0,0,0,0,0,0,1,0,0,1],(10,15)),
                ([0,0,0,1,0,1,0,1,1,0],(11,0)),
                ([0,0,0,1,0,1,0,1,0],(11,1)),
                ([0,0,0,1,0,1,0,0,0],(11,2)),
                ([0,0,0,1,0,0,1,0,1],(11,3)),
                ([0,0,0,1,0,0,0,1,1,0],(11,4)),
                ([0,0,0,1,0,0,0,0,0,0],(11,5)),
                ([0,0,0,0,1,1,0,1,0,0],(11,6)),
                ([0,0,0,0,1,0,1,0,1,1],(11,7)),
                ([0,0,0,0,1,0,0,0,1,1,0],(11,8)),
                ([0,0,0,0,0,1,1,0,1,1,1],(11,9)),
                ([0,0,0,0,0,1,0,1,0,1,0],(11,10)),
                ([0,0,0,0,0,0,1,1,0,0,1],(11,11)),
                ([0,0,0,0,0,0,0,1,1,1,0,1],(11,12)),
                ([0,0,0,0,0,0,0,1,0,0,1,0],(11,13)),
                ([0,0,0,0,0,0,0,0,1,0,1,1],(11,14)),
                ([0,0,0,0,0,0,0,0,0,1,0,1,1],(11,15)),
                ([0,0,0,0,1,1,1,0,1,1,0],(12,0)),
                ([0,0,0,1,0,0,0,1,0,0],(12,1)),
                ([0,0,0,0,1,1,1,1,0],(12,2)),
                ([0,0,0,0,1,1,0,1,1,1],(12,3)),
                ([0,0,0,0,1,1,0,0,1,0],(12,4)),
                ([0,0,0,0,1,0,1,1,1,0],(12,5)),
                ([0,0,0,0,1,0,0,1,0,1,0],(12,6)),
                ([0,0,0,0,1,0,0,0,0,0,1],(12,7)),
                ([0,0,0,0,0,1,1,0,0,0,1],(12,8)),
                ([0,0,0,0,0,1,0,0,1,1,1],(12,9)),
                ([0,0,0,0,0,0,1,1,0,0,0],(12,10)),
                ([0,0,0,0,0,0,1,0,0,0,0],(12,11)),
                ([0,0,0,0,0,0,0,1,0,1,1,0],(12,12)),
                ([0,0,0,0,0,0,0,0,1,1,0,1],(12,13)),
                ([0,0,0,0,0,0,0,0,0,1,1,1,0],(12,14)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,1],(12,15)),
                ([0,0,0,0,1,0,1,1,0,1,1],(13,0)),
                ([0,0,0,0,1,0,1,1,0,0],(13,1)),
                ([0,0,0,0,1,0,0,1,1,1],(13,2)),
                ([0,0,0,0,1,0,0,1,1,0],(13,3)),
                ([0,0,0,0,1,0,0,0,1,0],(13,4)),
                ([0,0,0,0,0,1,1,1,1,1,1],(13,5)),
                ([0,0,0,0,0,1,1,0,1,0,0],(13,6)),
                ([0,0,0,0,0,1,0,1,1,0,1],(13,7)),
                ([0,0,0,0,0,0,1,1,1,1,1],(13,8)),
                ([0,0,0,0,0,0,1,1,0,1,0,0],(13,9)),
                ([0,0,0,0,0,0,0,1,1,1,0,0],(13,10)),
                ([0,0,0,0,0,0,0,1,0,0,1,1],(13,11)),
                ([0,0,0,0,0,0,0,0,1,1,1,0],(13,12)),
                ([0,0,0,0,0,0,0,0,1,0,0,0],(13,13)),
                ([0,0,0,0,0,0,0,0,0,1,0,0,1],(13,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,1],(13,15)),
                ([0,0,0,0,0,1,1,1,1,0,1,1],(14,0)),
                ([0,0,0,0,0,1,1,1,1,0,0],(14,1)),
                ([0,0,0,0,0,1,1,1,0,1,0],(14,2)),
                ([0,0,0,0,0,1,1,0,1,0,1],(14,3)),
                ([0,0,0,0,0,1,0,1,1,1,1],(14,4)),
                ([0,0,0,0,0,1,0,1,0,1,1],(14,5)),
                ([0,0,0,0,0,1,0,0,0,0,0],(14,6)),
                ([0,0,0,0,0,0,1,0,1,1,0],(14,7)),
                ([0,0,0,0,0,0,1,0,0,1,0,1],(14,8)),
                ([0,0,0,0,0,0,0,1,1,0,0,0],(14,9)),
                ([0,0,0,0,0,0,0,1,0,0,0,1],(14,10)),
                ([0,0,0,0,0,0,0,0,1,1,0,0],(14,11)),
                ([0,0,0,0,0,0,0,0,0,1,1,1,1],(14,12)),
                ([0,0,0,0,0,0,0,0,0,1,0,1,0],(14,13)),
                ([0,0,0,0,0,0,0,0,0,0,1,0],(14,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,1],(14,15)),
                ([0,0,0,0,0,1,0,0,0,1,1,1],(15,0)),
                ([0,0,0,0,0,1,0,0,1,0,1],(15,1)),
                ([0,0,0,0,0,1,0,0,0,1,0],(15,2)),
                ([0,0,0,0,0,0,1,1,1,1,0],(15,3)),
                ([0,0,0,0,0,0,1,1,1,0,0],(15,4)),
                ([0,0,0,0,0,0,1,0,1,0,0],(15,5)),
                ([0,0,0,0,0,0,1,0,0,0,1],(15,6)),
                ([0,0,0,0,0,0,0,1,1,0,1,0],(15,7)),
                ([0,0,0,0,0,0,0,1,0,1,0,1],(15,8)),
                ([0,0,0,0,0,0,0,1,0,0,0,0],(15,9)),
                ([0,0,0,0,0,0,0,0,1,0,1,0],(15,10)),
                ([0,0,0,0,0,0,0,0,0,1,1,0],(15,11)),
                ([0,0,0,0,0,0,0,0,0,1,0,0,0],(15,12)),
                ([0,0,0,0,0,0,0,0,0,0,1,1,0],(15,13)),
                ([0,0,0,0,0,0,0,0,0,0,0,1,0],(15,14)),
                ([0,0,0,0,0,0,0,0,0,0,0,0,0],(15,15))]

tableHuffR13 :: [([Int], (Int, Int))]
tableHuffR13 = [([1],(0,0)),
                ([0,1,0,1],(0,1)),
                ([0,0,1,1,1,0],(0,2)),
                ([0,0,1,0,1,1,0,0],(0,3)),
                ([0,0,1,0,0,1,0,1,0],(0,4)),
                ([0,0,0,1,1,1,1,1,1],(0,5)),
                ([0,0,0,1,1,0,1,1,1,0],(0,6)),
                ([0,0,0,1,0,1,1,1,0,1],(0,7)),
                ([0,0,0,1,0,1,0,1,1,0,0],(0,8)),
                ([0,0,0,1,0,0,1,0,1,0,1],(0,9)),
                ([0,0,0,1,0,0,0,1,0,1,0],(0,10)),
                ([0,0,0,0,1,1,1,1,0,0,1,0],(0,11)),
                ([0,0,0,0,1,1,1,0,0,0,0,1],(0,12)),
                ([0,0,0,0,1,1,0,0,0,0,1,1],(0,13)),
                ([0,0,0,0,1,0,1,1,1,1,0,0,0],(0,14)),
                ([0,0,0,0,1,0,0,0,1],(0,15)),
                ([0,1,1],(1,0)),
                ([0,1,0,0],(1,1)),
                ([0,0,1,1,0,0],(1,2)),
                ([0,0,1,0,1,0,0],(1,3)),
                ([0,0,1,0,0,0,1,1],(1,4)),
                ([0,0,0,1,1,1,1,1,0],(1,5)),
                ([0,0,0,1,1,0,1,0,1],(1,6)),
                ([0,0,0,1,0,1,1,1,1],(1,7)),
                ([0,0,0,1,0,1,0,0,1,1],(1,8)),
                ([0,0,0,1,0,0,1,0,1,1],(1,9)),
                ([0,0,0,1,0,0,0,1,0,0],(1,10)),
                ([0,0,0,0,1,1,1,0,1,1,1],(1,11)),
                ([0,0,0,0,1,1,0,0,1,0,0,1],(1,12)),
                ([0,0,0,0,1,1,0,1,0,1,1],(1,13)),
                ([0,0,0,0,1,1,0,0,1,1,1,1],(1,14)),
                ([0,0,0,0,1,0,0,1],(1,15)),
                ([0,0,1,1,1,1],(2,0)),
                ([0,0,1,1,0,1],(2,1)),
                ([0,0,1,0,1,1,1],(2,2)),
                ([0,0,1,0,0,1,1,0],(2,3)),
                ([0,0,1,0,0,0,0,1,1],(2,4)),
                ([0,0,0,1,1,1,0,1,0],(2,5)),
                ([0,0,0,1,1,0,0,1,1,1],(2,6)),
                ([0,0,0,1,0,1,1,0,1,0],(2,7)),
                ([0,0,0,1,0,1,0,0,0,0,1],(2,8)),
                ([0,0,0,1,0,0,1,0,0,0],(2,9)),
                ([0,0,0,0,1,1,1,1,1,1,1],(2,10)),
                ([0,0,0,0,1,1,1,0,1,0,1],(2,11)),
                ([0,0,0,0,1,1,0,1,1,1,0],(2,12)),
                ([0,0,0,0,1,1,0,1,0,0,0,1],(2,13)),
                ([0,0,0,0,1,1,0,0,1,1,1,0],(2,14)),
                ([0,0,0,0,1,0,0,0,0],(2,15)),
                ([0,0,1,0,1,1,0,1],(3,0)),
                ([0,0,1,0,1,0,1],(3,1)),
                ([0,0,1,0,0,1,1,1],(3,2)),
                ([0,0,1,0,0,0,1,0,1],(3,3)),
                ([0,0,1,0,0,0,0,0,0],(3,4)),
                ([0,0,0,1,1,1,0,0,1,0],(3,5)),
                ([0,0,0,1,1,0,0,0,1,1],(3,6)),
                ([0,0,0,1,0,1,0,1,1,1],(3,7)),
                ([0,0,0,1,0,0,1,1,1,1,0],(3,8)),
                ([0,0,0,1,0,0,0,1,1,0,0],(3,9)),
                ([0,0,0,0,1,1,1,1,1,1,0,0],(3,10)),
                ([0,0,0,0,1,1,0,1,0,1,0,0],(3,11)),
                ([0,0,0,0,1,1,0,0,0,1,1,1],(3,12)),
                ([0,0,0,0,1,1,0,0,0,0,0,1,1],(3,13)),
                ([0,0,0,0,1,0,1,1,0,1,1,0,1],(3,14)),
                ([0,0,0,0,0,1,1,0,1,0],(3,15)),
                ([0,0,1,0,0,1,0,1,1],(4,0)),
                ([0,0,1,0,0,1,0,0],(4,1)),
                ([0,0,1,0,0,0,1,0,0],(4,2)),
                ([0,0,1,0,0,0,0,0,1],(4,3)),
                ([0,0,0,1,1,1,0,0,1,1],(4,4)),
                ([0,0,0,1,1,0,0,1,0,1],(4,5)),
                ([0,0,0,1,0,1,1,0,0,1,1],(4,6)),
                ([0,0,0,1,0,1,0,0,1,0,0],(4,7)),
                ([0,0,0,1,0,0,1,1,0,1,1],(4,8)),
                ([0,0,0,1,0,0,0,0,1,0,0,0],(4,9)),
                ([0,0,0,0,1,1,1,1,0,1,1,0],(4,10)),
                ([0,0,0,0,1,1,1,0,0,0,1,0],(4,11)),
                ([0,0,0,0,1,1,0,0,0,1,0,1,1],(4,12)),
                ([0,0,0,0,1,0,1,1,1,1,1,1,0],(4,13)),
                ([0,0,0,0,1,0,1,1,0,1,0,1,0],(4,14)),
                ([0,0,0,0,0,1,0,0,1],(4,15)),
                ([0,0,1,0,0,0,0,1,0],(5,0)),
                ([0,0,0,1,1,1,1,0],(5,1)),
                ([0,0,0,1,1,1,0,1,1],(5,2)),
                ([0,0,0,1,1,1,0,0,0],(5,3)),
                ([0,0,0,1,1,0,0,1,1,0],(5,4)),
                ([0,0,0,1,0,1,1,1,0,0,1],(5,5)),
                ([0,0,0,1,0,1,0,1,1,0,1],(5,6)),
                ([0,0,0,1,0,0,0,0,1,0,0,1],(5,7)),
                ([0,0,0,1,0,0,0,1,1,1,0],(5,8)),
                ([0,0,0,0,1,1,1,1,1,1,0,1],(5,9)),
                ([0,0,0,0,1,1,1,0,1,0,0,0],(5,10)),
                ([0,0,0,0,1,1,0,0,1,0,0,0,0],(5,11)),
                ([0,0,0,0,1,1,0,0,0,0,1,0,0],(5,12)),
                ([0,0,0,0,1,0,1,1,1,1,0,1,0],(5,13)),
                ([0,0,0,0,0,1,1,0,1,1,1,1,0,1],(5,14)),
                ([0,0,0,0,0,1,0,0,0,0],(5,15)),
                ([0,0,0,1,1,0,1,1,1,1],(6,0)),
                ([0,0,0,1,1,0,1,1,0],(6,1)),
                ([0,0,0,1,1,0,1,0,0],(6,2)),
                ([0,0,0,1,1,0,0,1,0,0],(6,3)),
                ([0,0,0,1,0,1,1,1,0,0,0],(6,4)),
                ([0,0,0,1,0,1,1,0,0,1,0],(6,5)),
                ([0,0,0,1,0,1,0,0,0,0,0],(6,6)),
                ([0,0,0,1,0,0,0,0,1,0,1],(6,7)),
                ([0,0,0,1,0,0,0,0,0,0,0,1],(6,8)),
                ([0,0,0,0,1,1,1,1,0,1,0,0],(6,9)),
                ([0,0,0,0,1,1,1,0,0,1,0,0],(6,10)),
                ([0,0,0,0,1,1,0,1,1,0,0,1],(6,11)),
                ([0,0,0,0,1,1,0,0,0,0,0,0,1],(6,12)),
                ([0,0,0,0,1,0,1,1,0,1,1,1,0],(6,13)),
                ([0,0,0,0,1,0,1,1,0,0,1,0,1,1],(6,14)),
                ([0,0,0,0,0,0,1,0,1,0],(6,15)),
                ([0,0,0,1,1,0,0,0,1,0],(7,0)),
                ([0,0,0,1,1,0,0,0,0],(7,1)),
                ([0,0,0,1,0,1,1,0,1,1],(7,2)),
                ([0,0,0,1,0,1,1,0,0,0],(7,3)),
                ([0,0,0,1,0,1,0,0,1,0,1],(7,4)),
                ([0,0,0,1,0,0,1,1,1,0,1],(7,5)),
                ([0,0,0,1,0,0,1,0,1,0,0],(7,6)),
                ([0,0,0,1,0,0,0,0,0,1,0,1],(7,7)),
                ([0,0,0,0,1,1,1,1,1,0,0,0],(7,8)),
                ([0,0,0,0,1,1,0,0,1,0,1,1,1],(7,9)),
                ([0,0,0,0,1,1,0,0,0,1,1,0,1],(7,10)),
                ([0,0,0,0,1,0,1,1,1,0,1,0,0],(7,11)),
                ([0,0,0,0,1,0,1,1,1,1,1,0,0],(7,12)),
                ([0,0,0,0,0,1,1,0,1,1,1,1,0,0,1],(7,13)),
                ([0,0,0,0,0,1,1,0,1,1,1,0,1,0,0],(7,14)),
                ([0,0,0,0,0,0,1,0,0,0],(7,15)),
                ([0,0,0,1,0,1,0,1,0,1],(8,0)),
                ([0,0,0,1,0,1,0,1,0,0],(8,1)),
                ([0,0,0,1,0,1,0,0,0,1],(8,2)),
                ([0,0,0,1,0,0,1,1,1,1,1],(8,3)),
                ([0,0,0,1,0,0,1,1,1,0,0],(8,4)),
                ([0,0,0,1,0,0,0,1,1,1,1],(8,5)),
                ([0,0,0,1,0,0,0,0,0,1,0,0],(8,6)),
                ([0,0,0,0,1,1,1,1,1,0,0,1],(8,7)),
                ([0,0,0,0,1,1,0,1,0,1,0,1,1],(8,8)),
                ([0,0,0,0,1,1,0,0,1,0,0,0,1],(8,9)),
                ([0,0,0,0,1,1,0,0,0,1,0,0,0],(8,10)),
                ([0,0,0,0,1,0,1,1,1,1,1,1,1],(8,11)),
                ([0,0,0,0,1,0,1,1,0,1,0,1,1,1],(8,12)),
                ([0,0,0,0,1,0,1,1,0,0,1,0,0,1],(8,13)),
                ([0,0,0,0,1,0,1,1,0,0,0,1,0,0],(8,14)),
                ([0,0,0,0,0,0,0,1,1,1],(8,15)),
                ([0,0,0,1,0,0,1,1,0,1,0],(9,0)),
                ([0,0,0,1,0,0,1,1,0,0],(9,1)),
                ([0,0,0,1,0,0,1,0,0,1],(9,2)),
                ([0,0,0,1,0,0,0,1,1,0,1],(9,3)),
                ([0,0,0,1,0,0,0,0,0,1,1],(9,4)),
                ([0,0,0,1,0,0,0,0,0,0,0,0],(9,5)),
                ([0,0,0,0,1,1,1,1,0,1,0,1],(9,6)),
                ([0,0,0,0,1,1,0,1,0,1,0,1,0],(9,7)),
                ([0,0,0,0,1,1,0,0,1,0,1,1,0],(9,8)),
                ([0,0,0,0,1,1,0,0,0,1,0,1,0],(9,9)),
                ([0,0,0,0,1,1,0,0,0,0,0,0,0],(9,10)),
                ([0,0,0,0,1,0,1,1,0,1,1,1,1,1],(9,11)),
                ([0,0,0,0,1,0,1,1,0,0,1,1,1],(9,12)),
                ([0,0,0,0,1,0,1,1,0,0,0,1,1,0],(9,13)),
                ([0,0,0,0,1,0,1,1,0,0,0,0,0],(9,14)),
                ([0,0,0,0,0,0,0,1,0,1,1],(9,15)),
                ([0,0,0,1,0,0,0,1,0,1,1],(10,0)),
                ([0,0,0,1,0,0,0,0,0,0,1],(10,1)),
                ([0,0,0,1,0,0,0,0,1,1],(10,2)),
                ([0,0,0,0,1,1,1,1,1,0,1],(10,3)),
                ([0,0,0,0,1,1,1,1,0,1,1,1],(10,4)),
                ([0,0,0,0,1,1,1,0,1,0,0,1],(10,5)),
                ([0,0,0,0,1,1,1,0,0,1,0,1],(10,6)),
                ([0,0,0,0,1,1,0,1,1,0,1,1],(10,7)),
                ([0,0,0,0,1,1,0,0,0,1,0,0,1],(10,8)),
                ([0,0,0,0,1,0,1,1,1,0,0,1,1,1],(10,9)),
                ([0,0,0,0,1,0,1,1,1,0,0,0,0,1],(10,10)),
                ([0,0,0,0,1,0,1,1,0,1,0,0,0,0],(10,11)),
                ([0,0,0,0,0,1,1,0,1,1,1,0,1,0,1],(10,12)),
                ([0,0,0,0,0,1,1,0,1,1,1,0,0,1,0],(10,13)),
                ([0,0,0,0,0,1,1,0,1,1,0,1,1,1],(10,14)),
                ([0,0,0,0,0,0,0,1,0,0],(10,15)),
                ([0,0,0,0,1,1,1,1,0,0,1,1],(11,0)),
                ([0,0,0,0,1,1,1,1,0,0,0],(11,1)),
                ([0,0,0,0,1,1,1,0,1,1,0],(11,2)),
                ([0,0,0,0,1,1,1,0,0,1,1],(11,3)),
                ([0,0,0,0,1,1,1,0,0,0,1,1],(11,4)),
                ([0,0,0,0,1,1,0,1,1,1,1,1],(11,5)),
                ([0,0,0,0,1,1,0,0,0,1,1,0,0],(11,6)),
                ([0,0,0,0,1,0,1,1,1,0,1,0,1,0],(11,7)),
                ([0,0,0,0,1,0,1,1,1,0,0,1,1,0],(11,8)),
                ([0,0,0,0,1,0,1,1,1,0,0,0,0,0],(11,9)),
                ([0,0,0,0,1,0,1,1,0,1,0,0,0,1],(11,10)),
                ([0,0,0,0,1,0,1,1,0,0,1,0,0,0],(11,11)),
                ([0,0,0,0,1,0,1,1,0,0,0,0,1,0],(11,12)),
                ([0,0,0,0,0,1,1,0,1,1,1,1,1],(11,13)),
                ([0,0,0,0,0,1,1,0,1,1,0,1,0,0],(11,14)),
                ([0,0,0,0,0,0,0,0,1,1,0],(11,15)),
                ([0,0,0,0,1,1,0,0,1,0,1,0],(12,0)),
                ([0,0,0,0,1,1,1,0,0,0,0,0],(12,1)),
                ([0,0,0,0,1,1,0,1,1,1,1,0],(12,2)),
                ([0,0,0,0,1,1,0,1,1,0,1,0],(12,3)),
                ([0,0,0,0,1,1,0,1,1,0,0,0],(12,4)),
                ([0,0,0,0,1,1,0,0,0,0,1,0,1],(12,5)),
                ([0,0,0,0,1,1,0,0,0,0,0,1,0],(12,6)),
                ([0,0,0,0,1,0,1,1,1,1,1,0,1],(12,7)),
                ([0,0,0,0,1,0,1,1,0,1,1,0,0],(12,8)),
                ([0,0,0,0,0,1,1,0,1,1,1,1,0,0,0],(12,9)),
                ([0,0,0,0,0,1,1,0,1,1,1,0,1,1],(12,10)),
                ([0,0,0,0,1,0,1,1,0,0,0,0,1,1],(12,11)),
                ([0,0,0,0,0,1,1,0,1,1,1,0,0,0],(12,12)),
                ([0,0,0,0,0,1,1,0,1,1,0,1,0,1],(12,13)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0],(12,14)),
                ([0,0,0,0,0,0,0,0,1,0,0],(12,15)),
                ([0,0,0,0,1,0,1,1,1,0,1,0,1,1],(13,0)),
                ([0,0,0,0,1,1,0,1,0,0,1,1],(13,1)),
                ([0,0,0,0,1,1,0,1,0,0,1,0],(13,2)),
                ([0,0,0,0,1,1,0,1,0,0,0,0],(13,3)),
                ([0,0,0,0,1,0,1,1,1,0,0,1,0],(13,4)),
                ([0,0,0,0,1,0,1,1,1,1,0,1,1],(13,5)),
                ([0,0,0,0,1,0,1,1,0,1,1,1,1,0],(13,6)),
                ([0,0,0,0,1,0,1,1,0,1,0,0,1,1],(13,7)),
                ([0,0,0,0,1,0,1,1,0,0,1,0,1,0],(13,8)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1],(13,9)),
                ([0,0,0,0,0,1,1,0,1,1,1,0,0,1,1],(13,10)),
                ([0,0,0,0,0,1,1,0,1,1,0,1,1,0,1],(13,11)),
                ([0,0,0,0,0,1,1,0,1,1,0,1,1,0,0],(13,12)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1],(13,13)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,0,0,1],(13,14)),
                ([0,0,0,0,0,0,0,0,0,1,0],(13,15)),
                ([0,0,0,0,1,0,1,1,1,1,0,0,1],(14,0)),
                ([0,0,0,0,1,0,1,1,1,0,0,0,1],(14,1)),
                ([0,0,0,0,1,1,0,0,1,1,0],(14,2)),
                ([0,0,0,0,1,0,1,1,1,0,1,1],(14,3)),
                ([0,0,0,0,1,0,1,1,0,1,0,1,1,0],(14,4)),
                ([0,0,0,0,1,0,1,1,0,1,0,0,1,0],(14,5)),
                ([0,0,0,0,1,0,1,1,0,0,1,1,0],(14,6)),
                ([0,0,0,0,1,0,1,1,0,0,0,1,1,1],(14,7)),
                ([0,0,0,0,1,0,1,1,0,0,0,1,0,1],(14,8)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,0,1,0],(14,9)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,0],(14,10)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,1,1,1],(14,11)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0],(14,12)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,1,1,0],(14,13)),
                ([0,0,0,0,0,1,1,0,1,1,0,0,1,0],(14,14)),
                ([0,0,0,0,0,0,0,0,0,0,0],(14,15)),
                ([0,0,0,0,0,1,1,0,0],(15,0)),
                ([0,0,0,0,1,0,1,0],(15,1)),
                ([0,0,0,0,0,1,1,1],(15,2)),
                ([0,0,0,0,0,1,0,1,1],(15,3)),
                ([0,0,0,0,0,1,0,1,0],(15,4)),
                ([0,0,0,0,0,1,0,0,0,1],(15,5)),
                ([0,0,0,0,0,0,1,0,1,1],(15,6)),
                ([0,0,0,0,0,0,1,0,0,1],(15,7)),
                ([0,0,0,0,0,0,0,1,1,0,1],(15,8)),
                ([0,0,0,0,0,0,0,1,1,0,0],(15,9)),
                ([0,0,0,0,0,0,0,1,0,1,0],(15,10)),
                ([0,0,0,0,0,0,0,0,1,1,1],(15,11)),
                ([0,0,0,0,0,0,0,0,1,0,1],(15,12)),
                ([0,0,0,0,0,0,0,0,0,1,1],(15,13)),
                ([0,0,0,0,0,0,0,0,0,0,1],(15,14)),
                ([0,0,0,0,0,0,1,1],(15,15))]

tableHuffR14 :: [([Int], (Int, Int))]
tableHuffR14 = [([1,1,1,1],(0,0)),
                ([1,1,0,1],(0,1)),
                ([1,0,1,1,1,0],(0,2)),
                ([1,0,1,0,0,0,0],(0,3)),
                ([1,0,0,1,0,0,1,0],(0,4)),
                ([1,0,0,0,0,0,1,1,0],(0,5)),
                ([0,1,1,1,1,1,0,0,0],(0,6)),
                ([0,1,1,0,1,1,0,0,1,0],(0,7)),
                ([0,1,1,0,1,0,1,0,1,0],(0,8)),
                ([0,1,0,1,0,0,1,1,1,0,1],(0,9)),
                ([0,1,0,1,0,0,0,1,1,0,1],(0,10)),
                ([0,1,0,1,0,0,0,1,0,0,1],(0,11)),
                ([0,1,0,0,1,1,0,1,1,0,1],(0,12)),
                ([0,1,0,0,0,0,0,0,1,0,1],(0,13)),
                ([0,1,0,0,0,0,0,0,1,0,0,0],(0,14)),
                ([0,0,1,0,1,1,0,0,0],(0,15)),
                ([1,1,1,0],(1,0)),
                ([1,1,0,0],(1,1)),
                ([1,0,1,0,1],(1,2)),
                ([1,0,0,1,1,0],(1,3)),
                ([1,0,0,0,1,1,1],(1,4)),
                ([1,0,0,0,0,0,1,0],(1,5)),
                ([0,1,1,1,1,0,1,0],(1,6)),
                ([0,1,1,0,1,1,0,0,0],(1,7)),
                ([0,1,1,0,1,0,0,0,1],(1,8)),
                ([0,1,1,0,0,0,1,1,0],(1,9)),
                ([0,1,0,1,0,0,0,1,1,1],(1,10)),
                ([0,1,0,1,0,1,1,0,0,1],(1,11)),
                ([0,1,0,0,1,1,1,1,1,1],(1,12)),
                ([0,1,0,0,1,0,1,0,0,1],(1,13)),
                ([0,1,0,0,0,1,0,1,1,1],(1,14)),
                ([0,0,1,0,1,0,1,0],(1,15)),
                ([1,0,1,1,1,1],(2,0)),
                ([1,0,1,1,0],(2,1)),
                ([1,0,1,0,0,1],(2,2)),
                ([1,0,0,1,0,1,0],(2,3)),
                ([1,0,0,0,1,0,0],(2,4)),
                ([1,0,0,0,0,0,0,0],(2,5)),
                ([0,1,1,1,1,0,0,0],(2,6)),
                ([0,1,1,0,1,1,1,0,1],(2,7)),
                ([0,1,1,0,0,1,1,1,1],(2,8)),
                ([0,1,1,0,0,0,0,1,0],(2,9)),
                ([0,1,0,1,1,0,1,1,0],(2,10)),
                ([0,1,0,1,0,1,0,1,0,0],(2,11)),
                ([0,1,0,0,1,1,1,0,1,1],(2,12)),
                ([0,1,0,0,1,0,0,1,1,1],(2,13)),
                ([0,1,0,0,0,0,1,1,1,0,1],(2,14)),
                ([0,0,1,0,0,1,0],(2,15)),
                ([1,0,1,0,0,0,1],(3,0)),
                ([1,0,0,1,1,1],(3,1)),
                ([1,0,0,1,0,1,1],(3,2)),
                ([1,0,0,0,1,1,0],(3,3)),
                ([1,0,0,0,0,1,1,0],(3,4)),
                ([0,1,1,1,1,1,0,1],(3,5)),
                ([0,1,1,1,0,1,0,0],(3,6)),
                ([0,1,1,0,1,1,1,0,0],(3,7)),
                ([0,1,1,0,0,1,1,0,0],(3,8)),
                ([0,1,0,1,1,1,1,1,0],(3,9)),
                ([0,1,0,1,1,0,0,1,0],(3,10)),
                ([0,1,0,1,0,0,0,1,0,1],(3,11)),
                ([0,1,0,0,1,1,0,1,1,1],(3,12)),
                ([0,1,0,0,1,0,0,1,0,1],(3,13)),
                ([0,1,0,0,0,0,1,1,1,1],(3,14)),
                ([0,0,1,0,0,0,0],(3,15)),
                ([1,0,0,1,0,0,1,1],(4,0)),
                ([1,0,0,1,0,0,0],(4,1)),
                ([1,0,0,0,1,0,1],(4,2)),
                ([1,0,0,0,0,1,1,1],(4,3)),
                ([0,1,1,1,1,1,1,1],(4,4)),
                ([0,1,1,1,0,1,1,0],(4,5)),
                ([0,1,1,1,0,0,0,0],(4,6)),
                ([0,1,1,0,1,0,0,1,0],(4,7)),
                ([0,1,1,0,0,1,0,0,0],(4,8)),
                ([0,1,0,1,1,1,1,0,0],(4,9)),
                ([0,1,0,1,1,0,0,0,0,0],(4,10)),
                ([0,1,0,1,0,0,0,0,1,1],(4,11)),
                ([0,1,0,0,1,1,0,0,1,0],(4,12)),
                ([0,1,0,0,0,1,1,1,0,1],(4,13)),
                ([0,1,0,0,0,0,1,1,1,0,0],(4,14)),
                ([0,0,0,1,1,1,0],(4,15)),
                ([1,0,0,0,0,0,1,1,1],(5,0)),
                ([1,0,0,0,0,1,0],(5,1)),
                ([1,0,0,0,0,0,0,1],(5,2)),
                ([0,1,1,1,1,1,1,0],(5,3)),
                ([0,1,1,1,0,1,1,1],(5,4)),
                ([0,1,1,1,0,0,1,0],(5,5)),
                ([0,1,1,0,1,0,1,1,0],(5,6)),
                ([0,1,1,0,0,1,0,1,0],(5,7)),
                ([0,1,1,0,0,0,0,0,0],(5,8)),
                ([0,1,0,1,1,0,1,0,0],(5,9)),
                ([0,1,0,1,0,1,0,1,0,1],(5,10)),
                ([0,1,0,0,1,1,1,1,0,1],(5,11)),
                ([0,1,0,0,1,0,1,1,0,1],(5,12)),
                ([0,1,0,0,0,1,1,0,0,1],(5,13)),
                ([0,1,0,0,0,0,0,1,1,0],(5,14)),
                ([0,0,0,1,1,0,0],(5,15)),
                ([0,1,1,1,1,1,0,0,1],(6,0)),
                ([0,1,1,1,1,0,1,1],(6,1)),
                ([0,1,1,1,1,0,0,1],(6,2)),
                ([0,1,1,1,0,1,0,1],(6,3)),
                ([0,1,1,1,0,0,0,1],(6,4)),
                ([0,1,1,0,1,0,1,1,1],(6,5)),
                ([0,1,1,0,0,1,1,1,0],(6,6)),
                ([0,1,1,0,0,0,0,1,1],(6,7)),
                ([0,1,0,1,1,1,0,0,1],(6,8)),
                ([0,1,0,1,0,1,1,0,1,1],(6,9)),
                ([0,1,0,1,0,0,1,0,1,0],(6,10)),
                ([0,1,0,0,1,1,0,1,0,0],(6,11)),
                ([0,1,0,0,1,0,0,0,1,1],(6,12)),
                ([0,1,0,0,0,1,0,0,0,0],(6,13)),
                ([0,1,0,0,0,0,0,1,0,0,0],(6,14)),
                ([0,0,0,1,0,1,0],(6,15)),
                ([0,1,1,0,1,1,0,0,1,1],(7,0)),
                ([0,1,1,1,0,0,1,1],(7,1)),
                ([0,1,1,0,1,1,1,1],(7,2)),
                ([0,1,1,0,1,1,0,1],(7,3)),
                ([0,1,1,0,1,0,0,1,1],(7,4)),
                ([0,1,1,0,0,1,0,1,1],(7,5)),
                ([0,1,1,0,0,0,1,0,0],(7,6)),
                ([0,1,0,1,1,1,0,1,1],(7,7)),
                ([0,1,0,1,1,0,0,0,0,1],(7,8)),
                ([0,1,0,1,0,0,1,1,0,0],(7,9)),
                ([0,1,0,0,1,1,1,0,0,1],(7,10)),
                ([0,1,0,0,1,0,1,0,1,0],(7,11)),
                ([0,1,0,0,0,1,1,0,1,1],(7,12)),
                ([0,1,0,0,0,0,1,0,0,1,1],(7,13)),
                ([0,0,1,0,1,1,1,1,1,0,1],(7,14)),
                ([0,0,0,1,0,0,0,1],(7,15)),
                ([0,1,1,0,1,0,1,0,1,1],(8,0)),
                ([0,1,1,0,1,0,1,0,0],(8,1)),
                ([0,1,1,0,1,0,0,0,0],(8,2)),
                ([0,1,1,0,0,1,1,0,1],(8,3)),
                ([0,1,1,0,0,1,0,0,1],(8,4)),
                ([0,1,1,0,0,0,0,0,1],(8,5)),
                ([0,1,0,1,1,1,0,1,0],(8,6)),
                ([0,1,0,1,1,0,0,0,1],(8,7)),
                ([0,1,0,1,0,1,0,0,1],(8,8)),
                ([0,1,0,1,0,0,0,0,0,0],(8,9)),
                ([0,1,0,0,1,0,1,1,1,1],(8,10)),
                ([0,1,0,0,0,1,1,1,1,0],(8,11)),
                ([0,1,0,0,0,0,1,1,0,0],(8,12)),
                ([0,1,0,0,0,0,0,0,0,1,0],(8,13)),
                ([0,0,1,0,1,1,1,1,0,0,1],(8,14)),
                ([0,0,0,1,0,0,0,0],(8,15)),
                ([0,1,0,1,0,0,1,1,1,1],(9,0)),
                ([0,1,1,0,0,0,1,1,1],(9,1)),
                ([0,1,1,0,0,0,1,0,1],(9,2)),
                ([0,1,0,1,1,1,1,1,1],(9,3)),
                ([0,1,0,1,1,1,1,0,1],(9,4)),
                ([0,1,0,1,1,0,1,0,1],(9,5)),
                ([0,1,0,1,0,1,1,1,0],(9,6)),
                ([0,1,0,1,0,0,1,1,0,1],(9,7)),
                ([0,1,0,1,0,0,0,0,0,1],(9,8)),
                ([0,1,0,0,1,1,0,0,0,1],(9,9)),
                ([0,1,0,0,1,0,0,0,0,1],(9,10)),
                ([0,1,0,0,0,1,0,0,1,1],(9,11)),
                ([0,1,0,0,0,0,0,1,0,0,1],(9,12)),
                ([0,0,1,0,1,1,1,1,0,1,1],(9,13)),
                ([0,0,1,0,1,1,1,0,0,1,1],(9,14)),
                ([0,0,0,0,1,0,1,1],(9,15)),
                ([0,1,0,1,0,0,1,1,1,0,0],(10,0)),
                ([0,1,0,1,1,1,0,0,0],(10,1)),
                ([0,1,0,1,1,0,1,1,1],(10,2)),
                ([0,1,0,1,1,0,0,1,1],(10,3)),
                ([0,1,0,1,0,1,1,1,1],(10,4)),
                ([0,1,0,1,0,1,1,0,0,0],(10,5)),
                ([0,1,0,1,0,0,1,0,1,1],(10,6)),
                ([0,1,0,0,1,1,1,0,1,0],(10,7)),
                ([0,1,0,0,1,1,0,0,0,0],(10,8)),
                ([0,1,0,0,1,0,0,0,1,0],(10,9)),
                ([0,1,0,0,0,1,0,1,0,1],(10,10)),
                ([0,1,0,0,0,0,1,0,0,1,0],(10,11)),
                ([0,0,1,0,1,1,1,1,1,1,1],(10,12)),
                ([0,0,1,0,1,1,1,0,1,0,1],(10,13)),
                ([0,0,1,0,1,1,0,1,1,1,0],(10,14)),
                ([0,0,0,0,1,0,1,0],(10,15)),
                ([0,1,0,1,0,0,0,1,1,0,0],(11,0)),
                ([0,1,0,1,0,1,1,0,1,0],(11,1)),
                ([0,1,0,1,0,1,0,1,1],(11,2)),
                ([0,1,0,1,0,1,0,0,0],(11,3)),
                ([0,1,0,1,0,0,1,0,0],(11,4)),
                ([0,1,0,0,1,1,1,1,1,0],(11,5)),
                ([0,1,0,0,1,1,0,1,0,1],(11,6)),
                ([0,1,0,0,1,0,1,0,1,1],(11,7)),
                ([0,1,0,0,0,1,1,1,1,1],(11,8)),
                ([0,1,0,0,0,1,0,1,0,0],(11,9)),
                ([0,1,0,0,0,0,0,1,1,1],(11,10)),
                ([0,1,0,0,0,0,0,0,0,0,1],(11,11)),
                ([0,0,1,0,1,1,1,0,1,1,1],(11,12)),
                ([0,0,1,0,1,1,1,0,0,0,0],(11,13)),
                ([0,0,1,0,1,1,0,1,0,1,0],(11,14)),
                ([0,0,0,0,0,1,1,0],(11,15)),
                ([0,1,0,1,0,0,0,1,0,0,0],(12,0)),
                ([0,1,0,1,0,0,0,0,1,0],(12,1)),
                ([0,1,0,0,1,1,1,1,0,0],(12,2)),
                ([0,1,0,0,1,1,1,0,0,0],(12,3)),
                ([0,1,0,0,1,1,0,0,1,1],(12,4)),
                ([0,1,0,0,1,0,1,1,1,0],(12,5)),
                ([0,1,0,0,1,0,0,1,0,0],(12,6)),
                ([0,1,0,0,0,1,1,1,0,0],(12,7)),
                ([0,1,0,0,0,0,1,1,0,1],(12,8)),
                ([0,1,0,0,0,0,0,1,0,1],(12,9)),
                ([0,1,0,0,0,0,0,0,0,0,0],(12,10)),
                ([0,0,1,0,1,1,1,1,0,0,0],(12,11)),
                ([0,0,1,0,1,1,1,0,0,1,0],(12,12)),
                ([0,0,1,0,1,1,0,1,1,0,0],(12,13)),
                ([0,0,1,0,1,1,0,0,1,1,1],(12,14)),
                ([0,0,0,0,0,1,0,0],(12,15)),
                ([0,1,0,0,1,1,0,1,1,0,0],(13,0)),
                ([0,1,0,0,1,0,1,1,0,0],(13,1)),
                ([0,1,0,0,1,0,1,0,0,0],(13,2)),
                ([0,1,0,0,1,0,0,1,1,0],(13,3)),
                ([0,1,0,0,1,0,0,0,0,0],(13,4)),
                ([0,1,0,0,0,1,1,0,1,0],(13,5)),
                ([0,1,0,0,0,1,0,0,0,1],(13,6)),
                ([0,1,0,0,0,0,1,0,1,0],(13,7)),
                ([0,1,0,0,0,0,0,0,0,1,1],(13,8)),
                ([0,0,1,0,1,1,1,1,1,0,0],(13,9)),
                ([0,0,1,0,1,1,1,0,1,1,0],(13,10)),
                ([0,0,1,0,1,1,1,0,0,0,1],(13,11)),
                ([0,0,1,0,1,1,0,1,1,0,1],(13,12)),
                ([0,0,1,0,1,1,0,1,0,0,1],(13,13)),
                ([0,0,1,0,1,1,0,0,1,0,1],(13,14)),
                ([0,0,0,0,0,0,1,0],(13,15)),
                ([0,1,0,0,0,0,0,0,1,0,0,1],(14,0)),
                ([0,1,0,0,0,1,1,0,0,0],(14,1)),
                ([0,1,0,0,0,1,0,1,1,0],(14,2)),
                ([0,1,0,0,0,1,0,0,1,0],(14,3)),
                ([0,1,0,0,0,0,1,0,1,1],(14,4)),
                ([0,1,0,0,0,0,1,0,0,0],(14,5)),
                ([0,1,0,0,0,0,0,0,1,1],(14,6)),
                ([0,0,1,0,1,1,1,1,1,1,0],(14,7)),
                ([0,0,1,0,1,1,1,1,0,1,0],(14,8)),
                ([0,0,1,0,1,1,1,0,1,0,0],(14,9)),
                ([0,0,1,0,1,1,0,1,1,1,1],(14,10)),
                ([0,0,1,0,1,1,0,1,0,1,1],(14,11)),
                ([0,0,1,0,1,1,0,1,0,0,0],(14,12)),
                ([0,0,1,0,1,1,0,0,1,1,0],(14,13)),
                ([0,0,1,0,1,1,0,0,1,0,0],(14,14)),
                ([0,0,0,0,0,0,0,0],(14,15)),
                ([0,0,1,0,1,0,1,1],(15,0)),
                ([0,0,1,0,1,0,0],(15,1)),
                ([0,0,1,0,0,1,1],(15,2)),
                ([0,0,1,0,0,0,1],(15,3)),
                ([0,0,0,1,1,1,1],(15,4)),
                ([0,0,0,1,1,0,1],(15,5)),
                ([0,0,0,1,0,1,1],(15,6)),
                ([0,0,0,1,0,0,1],(15,7)),
                ([0,0,0,0,1,1,1],(15,8)),
                ([0,0,0,0,1,1,0],(15,9)),
                ([0,0,0,0,1,0,0],(15,10)),
                ([0,0,0,0,0,1,1,1],(15,11)),
                ([0,0,0,0,0,1,0,1],(15,12)),
                ([0,0,0,0,0,0,1,1],(15,13)),
                ([0,0,0,0,0,0,0,1],(15,14)),
                ([0,0,1,1],(15,15))]