Kagaya Ubuyashiki, the 97-th leader of the Demon Slayer Corps, Also known as Oyakata-sama to the Demon Slayer Corps, just met Tanjiro, Zenitsu, and Inosuke. Instantly, he knew there is something special about them. But as special they are, they also need special training to make their ability grow faster as well. You know they can be trained best by the hashiras(highest rank of demon slayers) but the hashiras are busy slaying demons (Donβt worry they respect the pandemic they are wearing masks, and saving people from demons is more important to them than quarantining right now). They are spread all around the world. They canβt come to the demon slayer headquarters to teach them. So, the Oyakata-Sama made a scheme so that they can learn properly.
Initially, Tanjiro, Zenitsu, and Inosuke each knew only one breathing technique. Then all three meet at the demon slayer headquarters every time they get free to teach their breathing techniques to each other. After that, they go separate ways and practice those breathing techniques under different hashiras. Tanjiro practices the techniques shown by Zenitsu for days and after that, Inosukeβs for days. But, as Tanjiro goes to train under the hashiras, they influence those techniques in a way that the number of breathing techniques Tanjiro knows increases by the summation of
Γ The number of techniques Zenitsu showed and
Γ The number of techniques Inosuke showed.
In the same way, Zenitsuβs and Inosukeβs practices get influenced following the rule mentioned below-
Lets say, after i-th meeting and finishing practice the number of breathing techniques Tanjiro, Zanitsu and Inosuke know are , and respectively. So,
= + ( Γ ) + ( Γ )
= + ( Γ ) + ( Γ )
= + ( Γ ) + ( Γ )
Today is such a day! They are going to meet again and Oyakata-Sama told me that they have met times before today. So, I was wondering how many techniques Tanjiro know before the meeting (Why Tanjiro? Iβll leave it to your imagination π). Anyway, the number of techniques Tanjiro know at this point might be so big that it might not fit into a 32-bit integer ( this is Demon Slayer in some parallel universe anything is possible π) that is why you have to output the value modulo . In other words, Print , initially .
The first line will be a single integer indicating the number of test cases. The following lines will contain seven integers , , , , , , separated by spaces.
Constraints:
You have to output lines in format ββ(without quotes) where is the number of test case and is .
Input | Output |
---|---|
3 1 2 0 0 0 0 3 1 1 1 1 1 1 4 1 0 1 0 1 0 10 | Case 1: 10 Case 2: 81 Case 3: 1024 |
For the 1st test case Initially, Tanjiro knows 1 technique, Zenitsu knows, 1 technique Inosuke knows 1 technique After 1st meeting and finishing their practice, Tanjiro knows 1+1Γ1+2Γ1=4 techniques Zenitsu knows 1+0Γ1+0Γ1=1 technique Inosuke knows 1+0Γ1+0Γ1=1 technique After 2nd meeting and finishing their practice, Tanjiro knows 4+1Γ1+2Γ1=7 techniques Zenitsu knows 1+0Γ1+0Γ1=1 technique Inosuke knows 1+0Γ1+0Γ1=1 technique After 3rd meeting and finishing their practice, Tanjiro, Zenitsu and Inosuke know 10 techniques, 1 technique and 1 technique respectively. |