How does number casting work?
Enter an upper-trigram number, a lower-trigram number and a moving-line number. The first two use remainders after division by 8; the third uses division by 6. A zero remainder becomes 8 or 6. The trigram order is Qian 1, Dui 2, Li 3, Zhen 4, Xun 5, Kan 6, Gen 7, Kun 8. Count lines from the bottom.