## On the Subject of Pie Flash

Oh, these aren't homemade, they were made in a factory. A bomb factory. They're bombs.

See Appendix π for pi identification reference.

A Pie Flash module repeatedly flashes between three different sequences of five consecutive digits within the first 500 digits of pi (π). The digits are ordered from left to right.

For each of the three sequences, search for the position of the first digit. Add the sum of these positions to the average of the numbers displayed on the module. Round down to the nearest integer. Take this number modulo 100. This result will be referred to as the number X.

Add up the third digit of the first number, the first digit of the second number, and the fourth digit of the third number, then take the least significant digit. This digit will be referred to as the number Y.

Find the sum of the digital roots of the positions of each number's first digit. This digit will be referred to as the number Z.

Follow all the rules below from top to bottom, pressing each digit only once:

- If X and Y are either both prime numbers or both composite numbers, press the fifth digit.
- If X and Z are either both even or both odd, press the fourth digit.
- If Y and Z are multiples of three, press the third digit.
- If Z is greater than 10, Y is not zero, and X is a multiple of Y, press the second digit.
- Press all the digits that are not pressed yet from left to right, starting from the first digit.