Impressed, the Elves issue you a challenge: determine the 30000000th number spoken. For example, given the same starting numbers as above:

Assignment

Given your starting numbers, what will be the 30000000th number spoken? Determine this in the following way:

Example

> recitation("0,3,6", 2020)
436
> recitation("1,3,2", 2020)
1
> recitation("2,1,3", 2020)
10
> recitation("1,2,3", 2020)
27
> recitation("2,3,1", 2020)
78
> recitation("3,2,1", 2020)
438
> recitation("3,1,2", 2020)
1836

> recitation("0,3,6", 30000000)
175594
> recitation("1,3,2", 30000000)
2578
> recitation("2,1,3", 30000000)
3544142
> recitation("1,2,3", 30000000)
261214
> recitation("2,3,1", 30000000)
6895259
> recitation("3,2,1", 30000000)
18
> recitation("3,1,2", 30000000)
362