The N-bonacci sequence, originally invented by @DJMcMayhem in this question, is a sequence generated by starting with the integers 0 and 1, and then adding the previous N numbers to generate the next number. The special N-bonacci sequence is an N-bonacci sequence beginning with a pair of numbers other than 0 and 1, which will be named X and Y. If N is greater than the number of terms already in the sequence, simply add all available terms.
So for example the normal fibonacci sequence has an N of 2 (takes the previous two items), and an X and Y of 0 and 1, or 1 and 1, depending on who you ask.
You are to write a program or function that checks whether an inputted integer (A) is part of the special N-bonacci sequence generated by the next three integers (using the second input as N, and the third and fourth as X and Y). Ensure that you handle the special case of N=1.
Four non-negative integers, A, N, X, and Y.
A truthy/falsy value that indicates whether A is part of the N-bonacci sequence generated by the N, X, and Y inputs.
Input: Output: 13,2,0,1->truthy 12,3,1,4->falsy 4,5,0,1-->truthy 8,1,8,9-->truthy 9,1,8,9-->truthy 12,5,0,1->falsy [0,1]>[0,1,1]>[0,1,1,2]>[0,1,1,2,4]>[0,1,1,2,4,8]>[0,1,1,2,4,8,16]>etc.
This is code-golf, so the lowest score in bytes wins.