On the Subject of Pie

What is the point of naming this module 'pie' if there is no pie?! The pie is a lie!

See Appendix π for pi identification reference.

A Pie module shows five consecutive significant digits within the first 500 digits of pi (π). The digits are ordered from left to right.

Search for the position of the first digit, from which the five digits begin. Add this position to the number displayed on the module. Take this sum modulo 100. This result will be referred to as the number X.

Add up all the five digits, then take the least significant digit. This digit will be referred to as the number Y.

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

  1. If X is a prime number, press the first digit.
  2. If X and Y are either both even or both odd, press the second digit.
  3. If X is a multiple of three, press the third digit.
  4. If Y is not zero, and X is a multiple of Y, press the fourth digit.
  5. Press all the digits that are not pressed yet from right to left, starting from the fifth digit.

Appendix π: Pi Identification Reference

Here are the first 500 significant digits of pi.

31415926535897932384
62643383279502884197
16939937510582097494
45923078164062862089
98628034825342117067
98214808651328230664
70938446095505822317
25359408128481117450
28410270193852110555
96446229489549303819
64428810975665933446
12847564823378678316
52712019091456485669
23460348610454326648
21339360726024914127
37245870066063155881
74881520920962829254
09171536436789259036
00113305305488204665
21384146951941511609
43305727036575959195
30921861173819326117
93105118548074462379
96274956735188575272
48912279381830119491