On the Subject of Rebooting M-OS

Make a big reboom!

This module use an unknown operation system. We're calling it "M-OS". At the start of each bomb, this OS will display a fatal error message. However, there is just a moving square instead of any text. The square will cycle through 4 of 7 possible colors: red, green, blue, yellow, cyan, magenta and white. To defuse it, simply reboot M-OS. Unfortunately, the bomb's time greatly affects M-OS and turns it into an advanced version, which is harder to reboot. As usual, rebooting takes 3 taps on the square. So all you need worry about is a pressing time. To calculate the pressing time, obtain 3 values and apply the final operation to them.

Calculating Value A

For this you need the square's colors and moves (it will be cycling through 4 moves). Using the table below, obtain 16 cells and add up all values in those cells. Modulo the received number by 1000. This is value A.

T B R L BL TR BR TL
Red 60 44 86 89 48 47 54 88
Green 45 71 48 65 49 93 98 87
Blue 68 92 83 96 77 53 99 64
Yellow 80 70 66 63 74 98 50 48
Cyan 54 48 83 53 81 57 61 91
Magenta 63 52 58 54 62 50 86 90
White 46 63 70 72 83 69 58 52

T - Square moves from bottom to top.

B - Square moves from top to bottom.

R - Square moves from left to right.

L - Square moves from right to left.

BL - Square moves from top-right corner to botton-left corner.

TR - Square moves from botom-left corner to top-right corner.

BR - Square moves from top-left corner to bottom-right corner.

TL - Square moves from bottom-right corner to top-left corner.

Calculating Value B

For this you need to modify your A value. Apply to value A 4 operations based on the square's colors in the order they appear on it. This is your value B.

ALWAYS modulo your number by 1000 after EACH applied operation.
Red An = An-1 + E
Green An = An-1 - E
Blue An = An-1 * n
Yellow An = 2An-1 + E * n
Cyan An = (An-1 * n) - E
Magenta An = E2 - An-1
White An = 2n2 - (An-1 * E)

E = sum of serial number digits.

n = current step of the sequence, starting from 1.

An-1 is the previous modified A value or your initial value A, if n=1.

Calculating Value C

Add value A to value B and modulo 10 to get a single digit. Press the status light when the last digit of the bomb's timer will equal the received digit. After one successful press the background will flash 2 of 26 possible colors. Using the table below, convert those 2 colors into a 6-digit base 3 number: take the red value, green value, and blue value of the first color. Then take the values from the second color in the same order. Also, each color has its own associated value that's written on itself in table below.

You can freely press the status light after one successful press.
Colors Red Red Red
Numbers 0 1 2 0 1 2 0 1 2
Green 0 99 75 66 15 38 93 12 89 46
1 33 90 76 45 81 55 19 27 91
2 63 71 35 42 50 14 69 21 99
Numbers 0 1 2
Colors Blue

Convert your base 3 values to decimal. Multiply it by last digit of the serial number (if it's 0, multiply it by 10) and then modulo 27. Convert the received digit back to a base 3 number and then to a color with table above. Take the associated value of your new color. This is value C.

Final modifications

Once you have calculated all 3 values, perform an operation to them using the table below. If value A or B is 0, make it 1.

Last digit of SN Operation Last digit of SN Operation
0 A + B + C 5 3C - (A + B)
1 ABS(B - C) * A 6 ((B - (B % 2)) / 2 - A) * C
2 B2 - (A + C) 7 -A + ABS(B - C)
3 2A - (B % C) 8 A* B * C
4 (A * B) % C 9 A - B - C
If the calculated value is negative, make it positive. If the calculated value greater than 1000, modulo it by 1000. If your value is less than 100, add 100 until it isn't.

Submission info

Once you have your final 3-digit value you can reboot the module. Tap the square 3 times when the last digit of the bomb's timer equals the first digit of your value, then the second, etc.

Appendix C0L0R: Color names

Black Maroon Red Indigo Plum Rose Blue Violet Magenta
Forest Olive Orange Teal Gray Salmon Azure Maya Pink
Green Lime Yellow Jade Mint Cream Cyan Aqua White

Some additional info

Each color is paired with each move in shown order.

When all 4 moves are done, the square will disappear for a second, then will repeat all moves again.

Submitting three of the same numbers will toggle colorblind mode.

Abs(x) - make x positive.

A % B or A modulo B - Subtract B from A until A is in range 0 to B.

The module will not depend on the bomb's timer if you submit your settings with twitch commands.