code to solve annoying discrete math probability problems