Pens problem
Mr. Russo is in his 60s and he loves traveling. He recently visited a country famous for its pens. He wants to gift a few pens as souvenirs to his grandchildren. Mr. Russo has N grandchildren so he visited a pen shop to purchase pens for them. The shopkeeper showed him A varieties (types) of pens, each variety (type) consisting of B number of pens. He has to select only C varieties (types) of pens in a set in such a way that when he distributes these pens among his grandchildren, each of them gets the same number of pens. If there are more than one such sets or combinations possible, then the set contributing to minimum number of pens per grandchild should be selected and the number of pens that every grandchild gets should be returned. Your task is to help Mr. Russo in finding the minimum number of pens each grandchild can get. Note: If no solution is possible, return -1 as your output. Input Specification: input1: An integer value A, denoting the variety of pens that the shopkeeper owns. input2: An integer value C, denoting the variety of pens to be selected by Mr. Russo. input3: An integer value N, denoting the number of grandchildren. input4: An integer array B, containing number of pens for each variety.