My solution to Escape the even demon

Needs some optimization