X=4240:(164Y+24Yx2)
But basically you count with 164 portions for cats, and since the dog supplies are twice as much, you double the bumber of dogs, so it's 48.
Now add up 164+48, which is 212. So in total, you are basically buying 212 portions of supplies, since you need 2 portions for the dogs.
Now divide 4240 by 212 and you get 20. 20 is the cost per portion, so for a dog it would be $40.
I hope I did it okay.