Let's try to enumerate the input sequences
So you have to deal with all the even number less than 8192.
With a simple loop you may generate all the input sequences.
For each sequence you may count the number of stuff bits by construction, e.g.
Note (as shown in
value = 240
), that stuff bits can contribute to the next sequence.
Good luck.