solved 31 with the same logic as 76