Madhav Jha's submission of pattern21 | CodeChef