A Day at Gaushala Maidan

0

0 votes
Problem

It's Varchas'14 and Badminton, Table Tennis and Squash need to be conducted in the indoor stadium at Gaushala. Event coordinators need to schedule the matches one after the other (no overlaps). However, to make the day even more interesting they decided that they will not conduct matches of the same sport immediately one after the other. You need to help the coordinators and tell them the number of ways to schedule the matches; given 3 integers n1, n2 and n3 number of matches of Badminton, Table Tennis and squash respectively that need to be scheduled.

Input:

The first line contains an integer T, the number of test cases. Then T test cases follow. Each test case is a single line with 3 integers n1, n2 and n3.

Output:

Print the number of ways to conduct matches in a new line for each test case.

Constraints:

1 <= T <= 100

0 <= n1, n2, n3 <= 15

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?