Prof. H.Pole and his Strict Classes

1

1 votes
Very-Easy
Problem

Prof. H.Pole takes classes every day from 9 to 10 AM . The Class is divided into 4 Catogories of Students .
1) The 9 Pointers , who arrives class between 8:01AM and 8:30AM.
2) The 8 Pointers ,who arrives class between 8:31 and 9:00 AM.
3) The Normal guys , who arrives class after 9:00 AM but before 10:00 AM ;)
4) The Unseen guys , who never go to class at any cost .

Prof. H.Pole is a Colorful Person . He will take class if the pattern of students arriving is different from all the Previous day .
What is the maximum number of days he will take classes ? As the number can be large , print answer mod 1000000007

Input : First line contains T denoting no. of test cases Next T lines contains four integer a,b,c,d denoting 9 pointers,8 pointers, normal guys and Unseen guys
Output : maximum number of days he will take classes

Constraints : 1 <= T,a,b,c,d <= 10^5

AUTHOR : trico

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
> Sample Test  3 0 0 0
> 
> Here There are three 9 pointers, so pattern can be 
1,2,3 
1,3,2
2,1,3
2,3,1
3,1,2
3,2,1
 Maximum number of days is 6 ;)
Editor Image

?