Sichuan University Programming Contest 2017 Final(team)

E: Mathon's Spell