How to solve (GNY07H) spoj problem.