## On the Subject of Rule of Three

"Third time's the charm." -Someone who somehow miraculously survived two previous bomb explosions.

Three spheres, colored red, yellow, and blue, are floating within a 3D space, along the *x*, *y*, and *z* axes. Each sphere is cycling through three different positions (known as "movements"). The movements will repeat until any sphere has been clicked. The end of the third movement from one cycle and the beginning of the first movement from the next cycle is separated by a long pause to indicate that the cycle has reset.

- They can be east or west from the center of the module (positive and negative
*x*axis/right and left), - They can be at the top or bottom of the module (positive and negative
*y*axis/top and bottom), - They can be north or south from the center of the module (positive and negative
*z*axis/back and front), - Or they can be in the middle of any of these axes (neutral or zero).

Take each axis and each position in the cycle, and interpret them as balanced ternary, where 3^{0} (the "least significant" trit) corresponds to the first cycle and 3^{2} (the "most significant" trit) corresponds to the third cycle. Convert these numbers back into decimal and assign them to the sphere's values. The three spheres should have three numbers each, one from *x*, one from *y*, and one from *z*.

With the three coordinates from each sphere, treat them as vertices of a triangle, and find the area of that triangle. The following explanation uses vectors and the cross product formula, although any method will work.

Denoting the points' coordinates as (x_{1}, y_{1}, z_{1}), (x_{2}, y_{2}, z_{2}) and (x_{3}, y_{3}, z_{3}), pick any of these points and form vectors accordingly:

- Let's say we choose a point number
*i*, then the vectors' coordinates would be (x_{j}- x_{i}, y_{j}- y_{i}, z_{j}- z_{i}) and (x_{k}- x_{i}, y_{k}- y_{i}, z_{k}- z_{i}), where*i*,*j*,*k*are non-equal values 1, 2, 3. - Then calculate the size (or norm) of the vector product of those two vectors. The vector product of vectors
`u`= (u_{1}, u_{2}, u_{3}),`v`= (v_{1}, v_{2}, v_{3}) is a vector`u`×`v`= (u_{2}v_{3}- v_{2}u_{3}, v_{1}u_{3}- u_{1}v_{3}, u_{1}v_{2}- v_{1}u_{2}). - The size of vector
`w`= (w_{1}, w_{2}, w_{3}) is a non-negative real number:`w`= √(w_{1}^{2}+ w_{2}^{2}+ w_{3}^{2}).

- Finally, halve the size to get the area of the triangle.

Once you have your area, remove any decimals, and convert it back into balanced ternary. Select any sphere to move to input phase.

Starting from the least significant digit, input your number one trit at a time, where red is -1, yellow is 0, and blue is 1. Input your answer before the spheres shrink completely to disarm the module.