Here's the riddle:

A hundred prisoners are each locked in a room with three pirates, one of whom will walk the plank in the morning. Each prisoner has ten bottles of wine, one of which has been poisoned, and each pirate has twelve coins, one of which is counterfeit and weighs either more or less than a genuine coin. In the room is a single switch, which a prisoner can leave as is or can flip. Before being led into the rooms, they are all made to wear either a blue hat, or a red hat; they can see all the other prisoner's hats but not their own. Meanwhile, a six digit prime number of monkeys multiplies until their digits reverse, and then all have to get accross a river on a canoe that can only hold a maximum of two monkeys at a time. But half the monkeys always lie, and the others always tell the truth. Given that the Nth prisoner knows that one of the monkeys doesn't know that a pirate doesn't know the product of two numbers between 1 and 100 without knowing the N+1th prisoner has flipped the switch in his room or not after determining which bottle of wine was poisoned and which color his hat is, what is the solution to this puzzle?

Good luck.

You walk the plank in the morning and try not to get a headache beforehand.

Also this is more of a gremlin chatter thing.