math logic story