F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Rikka with Badminton

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1215    Accepted Submission(s): 661


Problem Description
In the last semester, Rikka joined the badminton club.

There are $n$ students in the badminton club, some of them have rackets, and some of them have balls. Formally, there are $a$ students have neither rackets nor balls, $b$ students have only rackets, $c$ students have only balls, and $d$ students have both rackets and balls. $(a+b+c+d=n)$

This week, the club is going to organize students to play badminton. Each student can choose to take part in or not freely. So there are $2^n$ possible registration status.

To play badminton, there must be at least two students who have rackets and at least one students who have balls. So if there aren't enough balls or rackets, the activity will fail.

Now, Rikka wants to calculate the number of the status among all $2^n$ possible registration status which will make the activity fail.
 

Input
The first line contains a single number $t(1 \leq t \leq 10^3)$, the number of testcases.

For each testcase, the first line contains four integers $a,b,c,d(0 \leq a,b,c,d \leq 10^7,a+b+c+d \geq 1)$.
 

Output
For each testcase, output a single line with a single integer, the answer modulo $998244353$.
 

Sample Input
3 1 1 1 1 2 2 2 2 3 4 5 6
 

Sample Output
12 84 2904
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 07:02:04, Gzip enabled