QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#782604#5530. No Zero-Sum SubsegmentSymbolizeAC ✓91ms34964kbC++201.6kb2024-11-25 20:38:172024-11-25 20:38:18

Judging History

你现在查看的是最新测评结果

  • [2024-11-25 20:38:18]
  • 评测
  • 测评结果:AC
  • 用时:91ms
  • 内存:34964kb
  • [2024-11-25 20:38:17]
  • 提交

answer

/*
	Luogu name: Symbolize
	Luogu uid: 672793
*/
#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define x first
#define y second
#define rep1(i,l,r) for(register int i=l;i<=r;++i)
#define rep2(i,l,r) for(register int i=l;i>=r;--i)
#define rep3(i,x,y,z) for(register int i=x[y];~i;i=z[i])
#define rep4(i,x) for(auto i:x)
#define debug() puts("----------")
const int N=4e6+10;
const int inf=0x3f3f3f3f3f3f3f3f;
const int mod=998244353;
using namespace std;
int t,prod[N],a,b,c,d;
int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return f*x;
}
int power(int a,int b,int p)
{
	int ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%p;
		a=a*a%p;
		b>>=1;
	}
	return ans;
}
int C(int n,int m)
{
	if(n<m) return 0;
	if(n<0||m<0) return 0;
	return prod[n]*power(prod[m],mod-2,mod)%mod*power(prod[n-m],mod-2,mod)%mod;
}
int calc(int b,int c,int d)
{
	if(d<2*b) return 0;
	return C(c+d-2*b+b,b)*C(c+d-2*b+b-b,c)%mod;
}
void getans()
{
	a=read();
	b=read();
	c=read();
	d=read();
	int x=-2*a-b+c+2*d;
	if(x==0)
	{
		puts("0");
		return;
	}
	if(x<0) swap(a,d),swap(b,c);
	cout<<(calc(b-2,c,d-a-2)*(a+1)%mod+calc(b-1,c-1,d-a-1)*a%mod*2%mod+calc(b,c-2,d-a)*(a>0)*(a-1)%mod+calc(b,c-1,d-a)*(a>0)*2%mod+calc(b-1,c,d-a-1)*2%mod+calc(b,c,d)*(!a)%mod)%mod<<"\n";
	return;
}
signed main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	prod[0]=1;
	rep1(i,1,4e6) prod[i]=prod[i-1]*i%mod;
	t=read();
	while(t--) getans();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 20ms
memory: 34808kb

input:

5
69 0 0 0
1 1 1 1
0 0 3 3
6 1 0 6
10000 10000 1000000 1000000

output:

1
0
20
2
480402900

result:

ok 5 number(s): "1 0 20 2 480402900"

Test #2:

score: 0
Accepted
time: 91ms
memory: 34876kb

input:

83520
13 1 6 8
13 9 3 14
1 16 13 0
8 12 7 16
10 5 9 15
16 16 15 1
5 11 0 4
12 4 11 15
16 7 1 10
2 6 3 3
15 14 12 0
0 8 12 12
3 0 6 7
16 2 16 15
16 16 16 13
8 13 2 14
7 9 7 0
9 8 4 6
13 16 4 11
11 1 12 4
7 9 4 16
12 13 0 4
5 0 9 1
11 11 0 3
1 11 14 3
3 3 7 3
8 5 4 4
6 7 12 14
2 11 5 6
15 4 9 14
15 11...

output:

0
0
0
0
0
0
52
0
26784
0
0
0
392
0
0
0
0
0
0
0
0
478686
0
136136
0
0
0
0
0
0
0
1680
0
821
0
24024
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8994258
0
0
0
0
0
293930
0
0
156637
166
0
0
0
0
0
0
0
0
0
54
0
0
1248
126
0
0
0
344
0
9867
10880
544
0
0
0
0
0
216580
0
0
4620
0
0
0
0
0
57915
0
0
0
10
0
72442440
0
1085473...

result:

ok 83520 numbers

Test #3:

score: 0
Accepted
time: 73ms
memory: 34932kb

input:

100000
27617 154585 61225 74297
699481 42306 265668 389057
94916 26621 153453 31500
425780 600614 439472 658406
180214 69209 369042 30297
67467 59798 156985 18873
501987 67164 156713 837634
534254 516732 831502 270708
671302 293648 947387 500010
32836 656676 169292 276528
98106 103776 160535 69726
3...

output:

0
0
0
0
0
0
194764989
0
0
0
0
0
0
0
763382948
0
0
0
949015107
0
0
0
0
0
0
0
0
0
805190744
0
0
0
166921450
0
0
0
0
0
0
0
0
774134257
0
0
780255367
0
497969058
0
0
0
0
0
0
0
0
0
0
0
856165384
0
0
0
868431198
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
320724406
0
...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 60ms
memory: 34876kb

input:

100000
58719 33026 48164 51150
25256 185757 125140 55564
194661 121907 44771 233229
249060 852053 865334 314598
832924 377083 60810 845556
934913 292101 320197 894291
20989 83322 14558 55371
327550 75392 525839 102326
71525 503165 407510 119352
459874 622834 707026 106953
65849 107929 217910 10858
3...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
634674089
0
0
0
0
764104266
0
0
508267610
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
539222878
48702106
0
0
0
0
0
0
0
0
0
0
577550206
0
0
0
0
0
0
397715714
0
0
0
0
0
72760701
0
0
0
0
0
0
0
0
0
537517797
0
0
0
215174626
0
0
0
6864...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 63ms
memory: 34932kb

input:

100000
5941 50819 38713 11994
274893 953821 48620 299319
45893 620324 16146 347982
204327 130053 153409 412334
272720 311527 416630 220168
765136 923124 339636 50583
129807 128630 10087 189078
257217 186497 354108 331226
282100 450244 255282 457422
226101 459570 444613 233579
164614 52871 205583 882...

output:

0
0
0
0
0
296933342
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
453176305
0
0
0
918517169
0
0
539376401
136577774
0
0
0
0
651578421
88133489
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
928783827
0
0
0
807979336
757750507
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
976196304
0
0
0
0
244588581
0
0
273331158
0
0...

result:

ok 100000 numbers

Test #6:

score: 0
Accepted
time: 60ms
memory: 34892kb

input:

100000
534 2278 170 1588
102592 337232 162666 189875
16311 546946 612313 314374
631285 469456 954538 251956
661532 653089 412221 882885
318859 13038 578574 36091
110058 269015 880401 772505
93119 17290 196137 3695
29463 170087 27777 100618
579473 947503 512979 645501
159386 586361 667265 118934
1340...

output:

0
0
0
0
0
0
700113238
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
914382015
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
183215844
0
0
0
284197109
0
0
0
0
0
0
106261876
0
0
0
662481442
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
172392525
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 51ms
memory: 34888kb

input:

100000
325053 265475 836899 39341
924988 903018 868573 209581
43791 148596 1309 117434
50578 55578 35992 60371
273882 90561 144728 246798
61592 40977 1948 81106
111333 127340 343730 3138
845096 890886 54864 856263
317746 621671 4580 606840
451833 95133 623582 697492
77516 970744 564976 805729
185351...

output:

0
0
0
0
0
0
0
0
0
80008605
0
0
0
0
0
0
0
0
0
0
0
0
0
0
487687301
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
274341937
0
0
53719296
0
0
651208403
0
0
0
0
0
0
0
0
283939399
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
884940662
0
0
0
0
0
0
0
0
0
0
0
406288474
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 65ms
memory: 34944kb

input:

100000
405340 73956 449424 217606
231193 396458 723050 146212
546227 309438 887926 456734
998896 594477 5883 297830
60845 132814 93952 80276
816876 397265 482463 350090
28168 225945 247709 17286
325924 63501 185639 264855
291479 185137 309966 374697
166038 366583 525794 86432
109137 630664 440578 95...

output:

0
0
0
478509240
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
140469630
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
813086393
0
292600864
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
233789292
0
0
0
507043898
92815206
0
0
0
0
0
0
0...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 58ms
memory: 34812kb

input:

100000
106964 647397 790509 35408
267794 26686 246321 157976
89466 726792 171693 367015
31825 134371 76934 60543
883191 886308 162544 23692
44352 454191 371920 85487
20591 32265 67994 2726
122425 84266 52610 138253
435637 341266 762584 615378
945758 409244 51772 864059
234380 34699 266207 118626
150...

output:

0
0
0
0
267245054
0
0
0
0
0
0
0
0
0
304250109
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
612476766
0
0
0
0
0
0
0
0
0
0
0
780075770
0
0
0
301587910
0
0
0
0
0
0
0
0
0
0
0
0
729409111
0
0
0
0
0
0
922949166
0
0
0
0
0
183235011
0
0
0
0
0
0
0
0
0
0
962264540
43224724
0
0
0
0
660839839
726233625
0
0
0
0
0
0
0...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 54ms
memory: 34872kb

input:

100000
360056 53450 539202 117180
844290 345656 543001 56474
3899 7910 13300 1204
176226 196961 10481 269466
26148 40882 29684 31747
872067 916938 4922 398458
296183 142128 10734 887862
639652 879410 678098 797185
939277 341734 617863 369108
540138 325715 903344 105198
799039 822644 788701 306950
72...

output:

0
0
0
0
0
630686956
535701968
0
0
0
0
0
0
0
0
0
0
512404147
0
0
942490429
0
0
0
0
0
0
0
66530161
0
0
0
0
0
443077747
0
0
0
0
0
840748258
0
0
0
0
0
0
0
0
985290976
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
431882255
0
0
0
0
0
718135492
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
851634074
0
0
0...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 61ms
memory: 34940kb

input:

100000
143908 426391 112547 300830
169742 564981 141015 381725
66134 759661 55891 418019
436830 653021 793055 109541
100262 447678 653655 422411
710162 635945 491894 989027
168987 714835 927240 437034
117686 205098 319591 60439
31647 289646 315579 18680
8411 179218 547227 986647
181740 128415 433806...

output:

0
0
0
0
0
0
0
0
0
725486585
0
0
0
0
0
90030904
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
278510837
0
0
0
47498401
0
0
0
0
0
0
0
182146479
0
0
0
0
473290179
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
898660231
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
680575188
0
0
0
0
0
0
0
0
0
0
577031...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 70ms
memory: 34832kb

input:

100000
638116 228467 661257 945105
327393 444074 957303 507360
241912 908074 519608 454903
266748 447591 31641 474723
361303 47755 734205 508264
182843 324481 56746 316710
78198 149575 281105 12433
6217 67236 69752 4959
56105 635927 606410 70863
180226 720416 390092 601546
552164 666620 561081 16594...

output:

0
0
0
0
247220605
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
49831911
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
679414444
0
0
0
0
0
0
403465667
353455409
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
588457023
0
0
0
0
0
0
666736930
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
716920878
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
96847723
0
0
0
982346557
...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 73ms
memory: 34876kb

input:

100000
629934 261413 92819 190792
783150 372549 967933 676695
590475 158192 858868 844177
200525 475740 468445 204172
138943 812932 537341 301488
617109 517186 83399 188966
503862 827895 207332 651450
1221 53013 55409 23
692886 430232 658888 396495
647165 826312 690558 732308
164416 37553 170370 980...

output:

77756970
0
0
0
0
652119663
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
984675528
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
826842297
0
0
0
360229622
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
432835395
682101384
0
0
0
0
0
0
0
0
0
147975049
0
0
0
0
0
0
0
0
0
0
0
0
0
0
895977155
0
0
0
0
0
0
0
745...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 55ms
memory: 34876kb

input:

100000
622436 293675 524382 361796
37455 298495 330355 21525
639291 864354 445310 123444
21761 256090 277788 10912
90160 374988 369375 92966
131711 73100 636548 673479
178826 519046 542555 945590
967834 110094 858966 43876
138105 37107 232459 40429
997892 833802 767466 131644
797996 943147 958372 26...

output:

0
0
0
0
0
863893295
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
415222323
0
0
0
0
0
0
0
0
947781761
0
0
0
0
0
0
0
0
0
0
0
0
0
916701521
0
0
0
0
0
0
0
459722047
0
0
753551061
0
0
0
0
0
0
0
981515997
929496314
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
636954397
0
0
0
0
374918592
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 64ms
memory: 34812kb

input:

100000
651937 326622 993628 607484
87930 89179 7414 128812
620774 249915 769427 462704
842878 902390 590020 762378
30804 217048 259960 9348
126874 677375 230703 350210
168001 186148 507250 100969
149839 505112 612279 96255
815274 300222 38466 387644
32237 133996 156858 20806
967345 900683 614995 891...

output:

0
0
0
0
0
0
0
0
851525494
0
0
30932531
309075476
0
0
0
0
0
0
0
0
0
0
0
0
0
0
840922290
0
0
0
0
0
0
0
0
0
0
0
0
0
957708392
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
783899548
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
178945821
0...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 70ms
memory: 34876kb

input:

100000
718438 358883 462189 853171
225788 46977 814826 295697
78433 232351 102174 143521
70598 703518 429643 387855
25962 32672 12233 36181
77855 161483 274445 21374
157862 852565 546628 218664
18249 38407 45261 14822
49134 730010 178328 324975
154453 33037 94670 123636
26256 446243 458270 20242
787...

output:

0
0
0
0
0
0
0
0
0
0
0
548561933
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
32014039
688145245
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
966062326
0
0
590546194
0
0
0
0
0
0
0
0
0
0
0
0
657898935
0
0
0
0
0
0
0
0
0
0
0
343956036
0
0
639735506
0
0
0
0
0
0
0
0
0
0
0
0
0
493518296
0
0
810848708
0
0
0
0
0
3983944...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 52ms
memory: 34964kb

input:

100000
710940 391830 893751 61174
718545 901455 751458 539030
40466 46365 105433 10932
54275 753244 778315 41739
250544 162987 228097 217989
586068 929854 731176 142358
59562 584051 464159 119508
165722 54579 302796 41613
737432 426072 419820 420360
609165 952131 424340 979690
172572 201264 457729 4...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
188573774
0
332357131
21169505
0
0
0
113477332
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
611892393
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 69ms
memory: 34864kb

input:

100000
740441 387093 362312 306861
174301 829930 688089 745364
264516 307937 286775 275097
11663 75756 78192 10445
266730 139508 785437 293346
523877 750615 298651 968501
223766 550016 454740 552083
298400 214982 404922 203430
216443 215876 524378 62192
9194 3012 2048 9676
13582 42279 67012 1215
399...

output:

0
0
0
0
0
0
0
0
0
0
0
0
671304061
0
0
0
0
0
0
0
0
0
0
0
0
0
386265540
0
0
0
0
0
0
15837296
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
867706883
0
0
0
0
0
43154124
0
0
0
0
0
0
0
0
0
0
388839390
0
0
0
0
0
0
0
0
0
0
0
0
0
408368551
0
0
0
0
502189878
0
0
0
0
0
0
0
0
0
0
0
0
0
266324571
0
0
0
0
0
0
0
4948457
0
...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 51ms
memory: 34932kb

input:

100000
695260 419354 831559 515550
184198 277450 65682 290082
768703 532483 917214 707377
939442 182268 60191 227285
954148 587612 984801 209515
150411 610872 26790 442452
927868 589395 647118 487905
22697 383677 257103 85984
575731 728256 302467 565804
830366 108611 732994 483234
341442 550772 1323...

output:

0
0
0
530126166
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
91652759
635305438
0
0
0
0
0
0
787159523
400596533
0
0
0
0
0
0
0
0
969012946
0
0
0
0
0
0
0
0
0
310915259
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
426562793
0
0
0
0
0
0
0
0
0
0
0
0
0
915252724
0
0
0
0
0
0
0
0
181099002...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 58ms
memory: 34892kb

input:

100000
724761 452301 300119 723554
173734 161603 229636 139717
131367 246550 354543 77370
231321 880 310904 76309
367062 11250 306136 219619
750938 77422 748923 788806
878280 226930 631968 554090
97703 194000 217160 86123
430302 397768 154028 401046
17685 58004 85604 3885
122954 219291 183015 141092...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
131360519
0
0
0
210454999
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
704661460
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
65294898
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
229380092
0
0
0
0
0
0
0
0
0
0
0
0
617...

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 66ms
memory: 34828kb

input:

100000
791262 447564 694683 6239
616940 504358 534983 364366
229607 491450 311214 72102
896206 814120 441239 730744
117278 554075 907647 379945
730531 869826 216790 336068
883194 173869 293511 956692
982260 721667 769326 73151
17044 2338 24521 5952
33029 892661 756255 101232
8257 130824 7259 70039
8...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
805895957
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
761960313
0
0
0
0
922099421
0
0
0
0
104505549
0
0
0
0
0
0
0
0
0
0
0
225356198
0
297728612
0
0
0
0
...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 65ms
memory: 34812kb

input:

100000
136652 504767 94536 341767
862104 320598 556926 907196
182189 634900 490197 254540
960650 674764 8114 880285
136661 214030 301252 711257
326716 165398 707588 840821
685434 933940 168331 443975
29005 323365 569727 831989
391175 17069 209723 294848
563502 458570 560586 339795
376112 524133 5784...

output:

0
0
0
431554119
925171693
333803883
0
365980493
0
0
0
0
0
0
0
0
0
0
0
0
69653793
302244044
0
0
0
0
0
0
0
0
0
0
0
9913509
0
128584403
0
0
810889218
695398518
0
0
0
0
87750433
0
409120786
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
946710902
0
0
0
0
468859584
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers