Unraveling the math of slot machines: a detailed guide