Drop links or images here to add them to the editor.

Now that you have the structure of your transmission decoded, you can calculate the value of the expression it represents.

Literal values (type ID 4) represent a single number as described above. The remaining type IDs are more interesting:

Using these rules, you can now work out the value of the outermost packet in your BITS transmission.

For example:

Assignment

What do you get if you evaluate the expression represented by your hexadecimal-encoded BITS transmission? Determine this in the following way:

Example

In this interactive session we assume the text files transmission01.txt, transmission02.txt, transmission03.txt, transmission04.txt and transmission05.txt to be located in the current directory.

>>> decode('transmission01.txt')
15
>>> decode('transmission02.txt')
46
>>> decode('transmission03.txt')
46
>>> decode('transmission04.txt')
54
>>> decode('transmission05.txt')
10637009915279