Solution for UVA 11559 giving RE.