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

ZCC loves math

Time Limit: 24000/15000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others)
Total Submission(s): 96    Accepted Submission(s): 5


Problem Description
Several days ago, ZCC found a summation formula on Miss G.'s scratch pad:

$$ \sum_{i\geq 0} \sum_{j\geq 0} (-1)^{s+t+i+j} {{s} \choose {i}} {{t} \choose {j}} {{n+pi+qj} \choose {m}} $$
    
$n, m, p, q, s, t$ are positive integers given which satisfy:

$ s,t\leq 10^9 $

$ s+t\leq m\leq s+t+50$

$ p,q \leq 20000 $

$ m\leq n \leq 10^{18} $

  
Please help him compute the result, modulo 998244353.
 

Input
First line contains a single integer $T(T=100)$ which denotes the number of test cases.
For each test case, there are four integers in a row: $n, m, p, q, s, t$.

For 80% of the test cases, $p, q \leq 1000$.
 

Output
For each test case, output a single line which is the answer.
 

Sample Input
3 3 2 1 1 1 1 5 3 1 1 1 1 10 7 2 3 2 3
 

Sample Output
1 5 9963
 

Source
 

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