 ## On the Subject of Not Really Quaternions At All

*puts some mathematical terms* BOOSH! The module is now impossible.

First things first: if you see `i2 = j2 = k2 = ijk = -1` on the module, then you are good.

Make a list with 4 numbers. We will call these [a, b, c, d] from now on.

Each number in this list has a number and a color.

Fill the two lists as follows:

• Each spot has the color of the symbols in the formula in this order:

[-1, i, j, k]

• Duplicate the list.
• Look at the module's buttons. For each pair of colors, fill in the first list with the largest number of the pair in the respective colored spot on the list.
• Same with the second list, but with the lowest numbers
NOTE: treat 0 as 10 when doing this.

Now, you have to swap the numbers with the same color if its corresponding condition applies:

 Either i or j is red. The bomb has at least one PS/2 port. The bomb's serial number contains a letter in the word BLUE. The sum of the two white keys is prime.

Now, some final touches to the lists:

• Substitute "0" by "10".
• If any number appears in the serial number (either one or more times), multiply that number by -1.
• If no lit indicators, multiply first list's b, c and d by -1.
Same with the second list in case of no unlit ones.

For the final step, let's label all the first and second lists' numbers:

`[a1, b1, c1, d1] and [a2, b2, c2, d2]`

Look at the color of the submit button, then look at which position is that color on any list; apply the formula depending on the position and submit that number:

``` 1 ⇒ (a1*a2 - b1*b2 - c1*c2 - d1*d2) 2 ⇒ (a1*b2 + b1*a2 + c1*d2 - d1*c2) 3 ⇒ (a1*c2 - b1*d2 + c1*a2 + d1*b2) 4 ⇒ (a1*d2 + b1*c2 - c1*b2 + d1*a2) ```

### Example:

Say, you have the following keypad:

i2 = j2 = k2 = i j k = -1

The colors of the list should be ``` [   ,   ,   ,    ] ```

The first list should be ``` [ 8, 9, 0, 4 ] ```

The second list should be ``` [ 7, 5, 1, 2 ] ```

Then, in our example, let's say the serial number is 136AS8, we haven't got any unlit indicators, we have a PS/2 port, and the submit button is blue, therefore the lists should be:

``` [ -8, 9, -1, 4 ] and [ 7, -5, -10, -2 ] ```

Recall we just did:

• Green applied ⇒ swap greens from the lists
• "0" ⇒ "10"
• 1 and 8 in s# ⇒ multiply them by -1 in the lists
• No unlit indicators ⇒ multiply b, c and d in the second list by -1

The submit button is blue, so we use the first formula, thus the answer is "-13".