Solution for little ibshop problem