Prof. H.Pole and his Strict Classes
Tag(s):

## Very-Easy

Problem
Editorial
Analytics

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

SAMPLE INPUT
1
3 0 0 0
SAMPLE OUTPUT
6
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 ;)

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

## CODE EDITOR

Initializing Code Editor...