solve p31