A thief plans to rob in a shop having 2 types of toys typeA toy and typeB toy.

Toys have some weight and cost.

i.e. Toy A has weight given by “weightOfA” and cost given by “ValueOfA”

similarly

ToyB has weight given by “weightOfB” and cost given by “ValueOfB”.

Shop has Infinite toys of both type.

Now thief has to rob some toys from the shop such that he generates maximum cost but the problem is that the thief has to carry the toys in a truck and the truck has a capacity (maximum weight which can be load on truck) given by “cap”,

Now you have to help Robber to generate maximum amount such that the toys can be carried in given capacity truck.

1 <= cap <= 10^9

1 <= valueOfA <= 10^9

1 < =valueOfB <= 10^9

1 <= weightOfA <= 10^9

1 <= weightOfB <= 10^9

We can’t run `for loop`

as it is order of 10^9. According to me it’s answer is something like this eqn :

K1 * wa + K2 * wb <= cap , where K1 and K2 are the number of toys of type A and type B