Yeongman's house is so old that water keeps leaking from the toilet. Fed up with it, Yeongman decides to fix the drainage himself by joining the spare pipes he has at home.
Cutting a pipe costs far too much, so he must join the leftover pipes as they are to build a pipe of exactly length x, without cutting any of them. Given the length and quantity of each pipe he owns, count the number of ways to join pipes into a total length of x. The order in which pipes are joined does not matter.