solve 31st problem