On the Subject of Rebooting Mystery 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 very affect on M-OS and turns it into advanced version. In advanced version, rebooting comes with specific properties that based on bomb's timer. As usual, rebooting takes 3 taps on the square. So all you need worry about, is a pressing time. To calculate pressing time, obtain 3 values and apply final operation to them.

Calculating Value A

For this you need square's colors and moves(square cycling through 4 moves). Using tabel below, obtain 16 cells and add up all values in that cells. Modulo 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, modulo 10 to get a single digit. Press status light when last digit of the timer will equal to recevied digit. After successful press background will flash 2 of 26 possible colors. Using table below, convert that 2 colours in 6-digit base 3 number: take red value, green value, blue value of first color. Then take values from second color in same order. Also, each color has own associated value that written on itself in table below.

You can freely press 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 3 base values to decimal. Multiply it by last digit of serial number (if it's 0, multiply it by 10) modulo 27. Convert recevied digit back to base 3 number and then to color with table above. Take associated value of your new color. This is value C.

Final modifications

Once, you calculated all 3 values, perform a operation to them using 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 calculated value is negative, make it positive. If calculated value greater than 1000, modulo it by 1000. If your value less than 100, add 100 until it is.

Submission info

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

Appendix C0L0R: Colour 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 paired with each move in shown order.

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

Submitting three same numbers will toggle colorblind mode.

Abs(x) - make x positive.

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

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