QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#413837#8647. JOI Tourhyforces#100 ✓1093ms134076kbC++206.5kb2024-05-18 09:47:232024-05-18 09:47:23

詳細信息

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 0ms
memory: 16452kb

input:

400
1 1 0 2 2 0 2 1 1 1 1 0 1 2 2 2 2 0 0 2 0 2 0 2 1 1 2 2 1 2 1 0 1 2 2 2 0 0 0 2 1 2 2 0 0 0 1 2 1 1 0 1 1 2 1 2 2 2 1 1 0 1 1 1 2 2 1 1 0 0 1 1 0 0 1 1 1 2 2 2 1 1 2 1 1 1 0 2 0 2 1 0 1 1 2 0 0 2 1 0 2 2 1 0 0 0 0 1 1 1 0 1 2 1 1 1 2 0 2 2 0 2 0 1 0 1 1 1 1 0 1 1 0 0 0 2 2 0 2 2 2 1 1 0 1 2 0 1 ...

output:

597892
604453
604236
600488
598028
594449
593671
586072
582432
581797
586919
588018
591441
592178
589303
587825
591777
595845
591906
591733
593937
592286
587593
583280
582383
580941
576582
577908
579779
578590
578141
577238
577854
584168
591759
594698
591476
590496
583825
582797
581264
586076
587779...

result:

ok 

Test #2:

score: 0
Accepted
time: 0ms
memory: 18136kb

input:

3
1 2 2
0 2
0 1
100
1 0
2 0
0 2
0 0
0 1
2 1
0 2
0 1
0 2
0 1
0 2
1 2
2 2
0 1
2 0
1 0
1 2
1 0
1 1
0 2
1 2
1 0
2 2
2 0
1 1
0 1
1 2
2 1
2 2
2 0
2 2
2 0
2 1
2 0
2 1
1 1
1 0
1 1
0 0
2 0
0 1
1 0
1 2
0 0
0 1
1 1
0 0
2 2
0 1
2 0
0 2
2 2
2 1
1 2
0 1
1 1
1 2
1 0
0 2
2 0
2 1
0 0
0 1
1 2
1 1
2 2
1 2
0 2
1 1
0 1
...

output:

0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 

Test #3:

score: 0
Accepted
time: 0ms
memory: 18208kb

input:

4
2 2 0 2
1 2
1 3
0 3
100
2 2
2 0
0 0
1 1
0 2
2 2
1 2
3 1
0 0
2 1
3 2
0 1
3 0
1 1
3 2
0 0
0 2
2 0
0 0
3 1
2 2
2 1
2 0
3 2
1 0
0 1
3 1
2 1
3 0
3 2
3 1
3 2
2 0
3 0
0 2
0 0
3 2
0 2
3 1
0 0
1 1
2 2
2 1
2 0
0 2
3 2
3 1
1 0
0 0
0 2
3 0
2 2
0 0
3 2
3 0
3 2
2 0
1 2
0 1
1 0
3 1
1 2
1 0
1 1
3 0
0 2
1 0
0 0
1 ...

output:

0
0
0
0
1
2
0
0
0
2
1
0
0
0
0
0
0
0
2
1
0
2
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
2
0
0
2
2
2
2
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
2
0
0
0
2
0
0
0
0
0
0
0
2
1
1
1
0
1
0
1
2
0
0
0
0
0
0
0
0
0

result:

ok 

Test #4:

score: 0
Accepted
time: 0ms
memory: 12004kb

input:

5
2 0 1 2 1
0 3
3 4
2 3
1 3
100
0 0
1 2
3 0
0 1
3 1
3 2
1 1
1 0
0 0
0 1
0 2
2 0
0 0
0 1
3 0
0 2
3 1
3 0
4 0
1 1
4 2
0 1
3 1
2 1
0 2
3 0
3 1
1 2
1 1
4 0
1 2
2 0
4 2
4 1
4 2
3 0
3 2
2 1
0 0
0 2
1 1
4 0
2 0
2 1
2 2
1 2
3 1
2 0
0 1
3 2
2 2
0 2
0 1
4 2
3 0
2 0
2 2
3 2
0 0
0 2
2 1
3 1
2 2
4 0
4 1
4 2
1 1
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
1
0
0
0
0
0
0
1
2
4
3
2
3
0
0
0
0
0
0
0
0
0
0
0
3
4
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
2
0
0
0
0
0
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 

Test #5:

score: 0
Accepted
time: 0ms
memory: 16096kb

input:

6
0 0 0 0 0 2
2 4
4 5
0 4
2 3
1 5
100
5 1
3 1
4 1
0 2
2 2
2 0
5 2
4 0
2 2
1 2
4 2
0 1
3 0
4 0
0 2
3 1
4 1
4 0
4 1
0 0
3 2
2 1
2 2
3 1
3 0
1 0
4 2
0 1
5 0
3 1
2 0
2 1
0 2
5 2
1 2
5 1
1 0
2 0
3 0
4 0
1 2
3 2
2 1
5 0
0 1
4 2
4 1
0 0
2 0
3 0
3 2
3 0
5 2
3 2
0 1
0 0
5 0
1 1
4 2
5 1
3 1
2 2
0 2
2 1
1 0
1 ...

output:

0
0
0
0
3
4
3
3
0
0
0
0
0
0
0
0
0
0
0
0
3
4
4
4
3
5
4
0
0
0
0
0
0
0
0
0
0
2
2
2
1
3
2
2
2
2
1
2
5
4
3
4
3
6
5
2
5
4
2
0
0
0
0
0
0
2
0
1
2
2
1
2
4
2
1
2
4
2
1
2
2
3
5
2
4
0
2
2
0
0
0
1
2
1
0
0
0
0
0
3
2

result:

ok 

Test #6:

score: 0
Accepted
time: 5ms
memory: 18228kb

input:

400
1 1 1 0 0 0 1 1 2 1 1 1 1 1 1 0 2 2 1 0 1 0 2 0 1 2 2 1 1 2 2 1 2 0 2 0 2 0 0 0 0 2 1 2 1 0 2 0 1 0 1 0 1 0 1 1 1 1 0 0 0 1 1 1 1 1 2 1 2 0 0 2 1 1 1 2 2 0 0 0 2 2 1 1 1 2 1 1 0 1 0 0 2 1 2 1 2 0 0 2 0 2 1 2 1 1 0 2 2 2 1 1 0 2 0 0 0 1 2 2 1 2 1 0 2 0 0 1 0 0 0 1 2 0 2 1 0 0 0 0 1 1 2 1 1 0 1 0 ...

output:

89736
92089
97184
97881
97958
97957
98575
98780
98194
98636
98571
98118
98137
96880
97697
97751
97126
95885
95846
95881
95780
96554
97541
97088
97147
97124
97229
97271
97761
98723
98751
99213
99575
99558
99541
100018
99689
100639
100160
101057
98928
99588
98995
99010
98196
103072
103702
103678
10365...

result:

ok 

Test #7:

score: 0
Accepted
time: 2ms
memory: 18188kb

input:

400
1 1 0 2 2 0 2 1 1 1 1 0 1 2 2 2 2 0 0 2 0 2 0 2 1 1 2 2 1 2 1 0 1 2 2 2 0 0 0 2 1 2 2 0 0 0 1 2 1 1 0 1 1 2 1 2 2 2 1 1 0 1 1 1 2 2 1 1 0 0 1 1 0 0 1 1 1 2 2 2 1 1 2 1 1 1 0 2 0 2 1 0 1 1 2 0 0 2 1 0 2 2 1 0 0 0 0 1 1 1 0 1 2 1 1 1 2 0 2 2 0 2 0 1 0 1 1 1 1 0 1 1 0 0 0 2 2 0 2 2 2 1 1 0 1 2 0 1 ...

output:

17280
17415
17280
17408
17272
17145
17272
17136
17000
16988
17112
16988
16851
16974
17097
17080
17202
17324
17202
17324
17466
17324
17182
17061
16940
16920
16800
16660
16541
16520
16380
16356
16497
16638
16779
16660
16520
16497
16356
16497
16638
16520
16541
16560
16577
16714
16592
16605
16728
16740
...

result:

ok 

Subtask #2:

score: 8
Accepted

Dependency #1:

100%
Accepted

Test #8:

score: 8
Accepted
time: 14ms
memory: 16964kb

input:

4000
2 0 2 1 2 1 0 2 0 2 2 1 0 2 2 2 2 1 1 2 2 1 1 0 2 0 0 2 1 0 0 1 1 1 0 2 0 2 2 1 0 2 2 1 0 2 2 1 2 2 0 2 0 1 1 2 2 0 2 0 0 1 0 0 0 1 2 1 0 2 2 1 0 0 0 0 1 2 0 0 1 2 1 0 0 1 2 2 1 2 0 2 0 2 1 2 1 0 0 1 1 2 2 2 1 2 2 0 2 0 1 2 0 1 2 1 2 2 1 1 1 2 0 0 0 0 1 2 2 2 0 1 1 2 2 2 0 1 0 0 2 1 1 0 2 0 1 0...

output:

620474975
620091276
620213053
620215716
620182492
619967950
620433875
620378867
619791163
620294584
620042350
620254670
619599499
619635328
619632073
619845490
620198042
620214770
620452856
620637250
620099913
620537344
620561024
620602104
620531392
620536225
620559149
621081398
621137321
621348648
...

result:

ok 

Test #9:

score: 0
Accepted
time: 10ms
memory: 18868kb

input:

4000
0 1 1 2 1 2 1 2 2 2 0 0 2 1 2 1 1 0 0 2 0 0 2 0 2 1 2 1 0 2 2 1 2 0 2 1 0 1 2 1 1 0 0 0 0 1 2 0 1 2 0 1 2 2 1 2 1 2 1 1 0 0 0 0 1 0 0 0 2 2 1 2 2 0 0 1 0 1 1 0 1 1 0 0 1 1 1 1 0 0 0 2 0 0 0 2 1 1 2 0 0 0 0 0 0 0 2 0 1 1 1 2 2 2 1 2 0 1 0 2 0 0 1 2 0 2 1 0 0 1 0 2 2 0 0 0 1 0 1 0 0 2 2 1 2 0 0 0...

output:

42768942
42797072
42797223
42840318
42832995
42797246
42797380
42817147
42816920
42815937
42778805
42753526
42752585
42787135
42764416
42796136
42796797
42766303
42765309
42764279
42740223
42739766
42767580
43539681
43587532
43564273
43590474
43562674
43561503
43524119
43524798
43524001
43525085
435...

result:

ok 

Test #10:

score: 0
Accepted
time: 6ms
memory: 16796kb

input:

4000
2 0 2 1 2 1 0 2 0 2 2 1 0 2 2 2 2 1 1 2 2 1 1 0 2 0 0 2 1 0 0 1 1 1 0 2 0 2 2 1 0 2 2 1 0 2 2 1 2 2 0 2 0 1 1 2 2 0 2 0 0 1 0 0 0 1 2 1 0 2 2 1 0 0 0 0 1 2 0 0 1 2 1 0 0 1 2 2 1 2 0 2 0 2 1 2 1 0 0 1 1 2 2 2 1 2 2 0 2 0 1 2 0 1 2 1 2 2 1 1 1 2 0 0 0 0 1 2 2 2 0 1 1 2 2 2 0 1 0 0 2 1 1 0 2 0 1 0...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 

Subtask #3:

score: 6
Accepted

Test #11:

score: 6
Accepted
time: 138ms
memory: 121364kb

input:

200000
0 2 2 0 2 2 0 1 1 0 2 2 0 1 2 2 0 1 0 2 1 1 0 1 0 2 0 2 0 0 0 1 0 0 2 0 2 1 0 0 1 1 1 0 0 2 1 2 2 1 0 2 2 2 0 2 2 1 2 0 1 0 0 1 2 0 0 2 1 1 1 0 1 1 1 2 1 0 1 1 0 1 2 2 2 0 1 0 1 1 0 2 0 1 0 2 0 0 2 2 2 2 2 0 0 2 1 2 2 1 2 0 1 1 1 1 1 0 2 0 2 0 1 1 1 0 1 0 2 1 2 0 1 1 0 2 1 2 2 2 0 0 2 2 2 0 1...

output:

77241161705660

result:

ok 

Test #12:

score: 0
Accepted
time: 126ms
memory: 122924kb

input:

200000
2 1 2 0 2 1 2 1 2 1 1 1 2 1 2 1 2 1 1 1 1 2 0 1 2 1 1 2 1 2 2 2 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 1 1 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 2 2 1 1 2 2 1 1 2 1 2 1 1 2 1 2 2 2 1 1 1 2 2 2 2 1 1 1 2 1 1 2 1 1 2 1 2 2 2 2 1 1 2 1 2 2 1 1 1 2 1 1 1 2 0 2 1 2 2 1 1 2 2 2 2 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2...

output:

14535453821146

result:

ok 

Test #13:

score: 0
Accepted
time: 145ms
memory: 119028kb

input:

200000
2 2 0 2 2 0 0 0 0 0 2 2 2 2 0 2 2 2 2 1 0 2 0 2 2 0 0 2 2 0 0 2 2 1 0 2 0 2 0 0 2 1 0 0 0 2 0 0 0 2 2 0 2 0 2 2 0 0 0 0 2 0 0 2 0 2 0 2 0 2 2 2 2 2 0 2 2 2 2 0 0 0 0 0 2 0 2 2 0 2 0 0 2 0 0 2 2 2 0 2 0 2 2 0 2 2 2 0 0 2 0 1 0 2 0 2 2 0 2 2 2 0 2 2 0 2 0 2 0 2 0 0 0 0 2 0 0 2 0 0 0 2 0 0 0 2 0...

output:

15024455356747

result:

ok 

Test #14:

score: 0
Accepted
time: 130ms
memory: 124384kb

input:

200000
1 0 0 1 2 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 2 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 0 1 0 0 0 0 0 1 2 1 0 1 1 1 1 0 1 2 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 1 0 1 0 1 0 1 0 1 2 1 0 0 1...

output:

14979709993295

result:

ok 

Test #15:

score: 0
Accepted
time: 96ms
memory: 118092kb

input:

200000
0 1 2 1 2 1 0 1 0 0 2 0 0 1 0 0 2 0 0 0 2 1 0 1 0 0 2 2 2 1 0 2 1 1 2 1 2 1 2 0 2 1 0 2 0 2 2 2 2 0 2 1 2 1 1 1 0 1 2 2 1 1 0 0 0 1 1 1 0 0 1 1 1 2 0 2 2 0 2 2 2 2 0 2 2 0 1 0 1 0 1 0 2 1 1 2 0 0 2 1 1 0 0 2 2 1 2 2 2 1 1 0 1 2 0 0 1 1 1 1 1 1 0 0 2 1 1 0 0 0 0 0 2 1 1 2 2 1 1 0 2 0 1 1 1 2 2...

output:

457084700208

result:

ok 

Test #16:

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

input:

200000
0 0 1 0 1 1 1 1 0 2 2 1 2 1 2 0 0 0 2 0 0 1 0 1 1 0 1 0 2 0 0 1 1 1 1 2 1 1 1 0 2 0 0 2 2 2 0 2 1 0 0 2 0 0 2 1 0 2 1 2 0 2 2 1 0 1 0 0 2 1 2 2 2 0 1 2 2 2 2 0 1 0 2 2 1 0 0 1 2 1 0 2 1 2 0 0 2 0 2 2 2 2 1 0 0 2 0 2 0 2 2 2 1 1 1 1 1 0 1 1 0 0 2 2 1 0 2 0 2 1 2 2 2 2 2 0 0 1 0 1 0 1 2 1 0 0 2...

output:

490004211265

result:

ok 

Test #17:

score: 0
Accepted
time: 120ms
memory: 116972kb

input:

200000
1 1 1 1 0 2 1 0 1 0 2 0 2 0 2 2 2 0 2 1 1 2 0 0 0 0 0 2 2 2 0 2 1 2 0 1 0 2 2 1 2 1 0 0 2 1 0 2 1 1 0 1 2 2 0 0 2 0 2 2 1 2 1 2 0 0 1 1 0 1 2 1 2 0 2 2 0 2 0 2 1 0 2 2 2 0 1 0 0 0 2 2 2 2 0 0 0 0 1 2 2 1 1 2 2 1 2 1 2 0 0 1 2 1 0 1 0 0 0 2 1 1 1 0 0 1 2 1 1 1 0 1 1 0 2 1 1 0 1 1 2 2 1 2 1 1 0...

output:

149609988117

result:

ok 

Test #18:

score: 0
Accepted
time: 133ms
memory: 118680kb

input:

200000
0 1 2 1 2 2 2 2 0 1 1 2 0 0 0 0 1 1 0 2 0 2 1 1 1 2 2 0 2 2 0 1 1 1 2 0 0 1 2 1 2 1 0 1 2 1 1 2 0 1 1 0 0 1 0 1 0 1 0 0 1 2 2 2 2 1 2 0 0 2 1 2 1 2 1 0 2 2 0 2 1 1 1 1 2 2 1 0 2 2 2 2 1 0 2 2 0 0 1 0 1 2 1 1 2 0 2 1 1 2 2 2 1 0 2 2 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 1 1 2 0 0 2 1 1 0 2 2 1 1 0 1...

output:

490004211265

result:

ok 

Test #19:

score: 0
Accepted
time: 135ms
memory: 119000kb

input:

200000
2 1 1 1 2 0 0 1 2 0 1 1 1 2 0 0 2 1 2 0 0 0 2 1 0 1 1 1 2 2 2 2 2 1 0 2 2 2 1 2 0 1 2 0 0 2 2 0 0 0 0 1 2 0 1 0 0 1 1 2 2 0 0 1 2 2 1 0 1 2 2 2 0 0 0 1 2 1 1 2 2 1 2 1 0 0 0 2 1 1 2 2 2 1 0 1 2 2 1 1 1 1 2 1 1 2 2 1 2 1 2 1 0 2 2 2 2 0 0 1 2 2 2 0 1 0 2 2 0 0 0 2 2 0 2 0 0 1 0 0 2 0 1 0 1 1 2...

output:

1812572240374

result:

ok 

Test #20:

score: 0
Accepted
time: 136ms
memory: 117704kb

input:

200000
1 0 0 2 0 2 0 0 2 1 2 1 0 0 0 1 1 2 1 2 0 2 0 0 2 0 2 0 2 1 1 1 2 2 0 0 2 2 2 1 1 2 2 0 2 0 0 0 0 0 1 1 0 0 0 1 2 0 1 2 1 2 0 1 2 0 0 0 2 2 2 1 2 2 0 1 2 1 1 0 0 1 1 2 0 1 0 0 2 0 2 2 0 2 2 2 0 1 0 1 0 0 2 0 1 2 1 1 1 0 1 1 1 0 0 2 2 1 0 2 0 1 2 2 1 1 1 1 1 1 0 0 1 0 2 1 2 0 0 1 2 0 2 2 2 0 0...

output:

7322589985203

result:

ok 

Test #21:

score: 0
Accepted
time: 141ms
memory: 125120kb

input:

200000
2 2 2 1 1 0 1 0 0 1 1 0 0 1 0 0 0 2 0 0 2 0 0 1 1 2 1 0 2 1 1 1 2 2 1 0 0 2 2 0 0 1 2 0 0 1 2 2 0 1 1 1 1 1 0 2 2 2 1 0 2 1 0 1 0 2 1 0 0 0 1 0 2 1 2 0 0 0 0 2 2 2 2 0 0 1 0 1 1 0 1 2 2 2 2 2 2 2 1 0 0 2 1 0 2 0 2 2 0 0 2 1 2 0 2 2 0 2 0 0 1 0 2 1 1 2 2 1 1 2 1 2 0 0 2 2 0 0 0 2 0 0 1 2 1 0 1...

output:

33075374608087

result:

ok 

Test #22:

score: 0
Accepted
time: 133ms
memory: 124792kb

input:

200000
2 1 1 2 2 2 2 1 2 1 2 0 1 2 1 1 2 2 1 2 2 2 2 2 1 2 1 1 1 1 2 1 2 1 1 2 2 1 2 1 2 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 0 1 1 2 1 1 2 2 1 1 1 1 1 1 2 2 0 1 1 2 1 2 1 2 2 2 1 1 2 1 0 1 2 2 2 1 2 1 1 1 1 0 1 1 2 1 0 2 2 1 1 2 2 2 0 1 2 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 2 2 2 2 1 2 2 1 1 1...

output:

6216545751865

result:

ok 

Test #23:

score: 0
Accepted
time: 147ms
memory: 123384kb

input:

200000
2 0 2 0 0 2 0 2 0 2 2 2 0 2 2 2 0 2 2 0 2 2 2 2 0 2 0 0 0 2 2 2 2 0 2 2 0 0 0 2 2 0 0 0 2 0 2 0 0 2 2 0 2 2 0 0 0 2 2 0 0 2 0 0 0 0 2 2 0 2 0 0 2 2 2 0 0 0 0 0 0 0 2 2 2 2 2 1 0 0 2 1 2 0 2 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 2 0 0 2 0 0 2 0 0 0 2 2 2 2 0 2 0 0 0 2 2 0 2 2 0 0 0 2 2 0 0 2 2 2 2 2 2...

output:

6090130973914

result:

ok 

Test #24:

score: 0
Accepted
time: 143ms
memory: 123248kb

input:

200000
1 1 0 0 1 2 0 2 0 0 0 1 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 1 0 1 0 2 0 0 1 1 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 2 0 1 2 1 0 0 0 2 0 0 0 2 0 0 1 1 1 2 1 1 1 0 1 0 1 1 2 1...

output:

6392103279027

result:

ok 

Test #25:

score: 0
Accepted
time: 146ms
memory: 127768kb

input:

200000
0 0 0 2 1 1 1 0 0 1 1 2 0 2 1 2 2 0 0 2 0 2 2 1 0 2 1 2 2 2 2 0 1 1 1 1 1 1 1 1 1 2 2 1 0 2 0 1 0 1 2 0 0 2 0 2 0 0 1 0 2 2 0 0 1 0 2 1 1 0 1 0 2 0 2 0 1 2 2 1 1 0 1 2 0 1 2 1 2 0 0 0 1 0 1 2 2 0 1 1 0 0 0 1 1 2 0 0 2 2 0 0 2 2 2 2 1 0 0 1 1 1 2 2 2 2 0 0 0 1 1 1 0 1 1 2 1 1 1 0 0 2 1 0 2 0 1...

output:

98889219873489

result:

ok 

Test #26:

score: 0
Accepted
time: 4ms
memory: 16332kb

input:

3
0 0 1
1 2
0 2
0

output:

0

result:

ok 

Test #27:

score: 0
Accepted
time: 0ms
memory: 16048kb

input:

4
0 0 1 1
0 2
1 2
2 3
0

output:

0

result:

ok 

Test #28:

score: 0
Accepted
time: 0ms
memory: 14000kb

input:

5
2 0 2 2 0
0 2
0 1
0 3
2 4
0

output:

0

result:

ok 

Test #29:

score: 0
Accepted
time: 3ms
memory: 16112kb

input:

6
1 0 2 2 0 1
1 3
4 5
0 4
0 1
2 5
0

output:

4

result:

ok 

Test #30:

score: 0
Accepted
time: 145ms
memory: 117084kb

input:

200000
0 0 0 2 0 0 1 0 2 2 2 1 2 0 1 0 0 0 0 1 0 2 0 2 1 0 2 2 2 2 2 0 0 2 2 0 1 1 0 1 1 0 1 2 2 2 0 1 2 1 2 2 1 0 2 2 2 1 2 2 2 0 1 2 2 2 2 2 1 1 0 0 1 0 2 0 2 1 1 2 2 0 2 1 2 0 2 2 1 2 2 2 0 2 2 2 0 2 0 1 1 1 2 0 1 2 2 1 2 0 2 0 0 2 1 1 2 2 0 2 0 2 0 1 0 0 0 0 2 0 1 2 0 1 2 2 2 0 1 0 0 2 2 2 1 0 0...

output:

827878641518

result:

ok 

Test #31:

score: 0
Accepted
time: 145ms
memory: 118220kb

input:

200000
1 1 2 2 1 1 2 2 2 2 2 1 2 2 2 2 2 1 2 1 2 2 1 2 1 2 2 2 2 2 1 2 1 1 1 2 2 2 1 0 1 2 2 2 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 1 2 1 2 2 2 1 2 1 1 1 2 2 2 1 1 2 1 2 1 1 2 1 1 1 0 2 1 1 1 2 1 2 2 2 1 2 1 1 1 2 1 1 2 2 1 2 1 2 1 1 1 2 0 2 1 1 2 2 2 1 2 2 2 2 2 1 2 1 1 2 2 1 1 1 2 1 2 1 2 2 1 1 1 1 1 1 1...

output:

148910253102

result:

ok 

Test #32:

score: 0
Accepted
time: 153ms
memory: 117468kb

input:

200000
2 0 2 2 0 2 0 0 0 2 2 0 2 0 0 0 0 2 0 2 0 0 0 2 0 0 0 0 2 0 0 2 0 2 1 0 0 0 2 2 0 2 2 0 0 2 2 0 1 2 2 2 1 0 0 2 0 2 2 0 2 2 0 0 2 2 0 2 0 2 2 0 2 2 0 2 2 0 2 0 0 0 0 2 2 2 0 0 0 2 2 2 2 0 0 0 2 2 0 2 0 2 1 2 2 0 0 2 2 0 2 0 1 2 2 0 2 0 0 2 2 0 0 0 1 0 0 0 0 0 2 0 0 2 0 0 0 0 2 2 0 2 2 0 2 2 2...

output:

181252557212

result:

ok 

Test #33:

score: 0
Accepted
time: 144ms
memory: 117940kb

input:

200000
1 0 2 1 2 1 0 0 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 2 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 2 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 1 1 0 0 1 0 1 1 1 0 1 1 0 0 0...

output:

155843324547

result:

ok 

Test #34:

score: 0
Accepted
time: 87ms
memory: 103120kb

input:

200000
0 2 2 0 2 2 0 1 1 0 2 2 0 1 2 2 0 1 0 2 1 1 0 1 0 2 0 2 0 0 0 1 0 0 2 0 2 1 0 0 1 1 1 0 0 2 1 2 2 1 0 2 2 2 0 2 2 1 2 0 1 0 0 1 2 0 0 2 1 1 1 0 1 1 1 2 1 0 1 1 0 1 2 2 2 0 1 0 1 1 0 2 0 1 0 2 0 0 2 2 2 2 2 0 0 2 1 2 2 1 2 0 1 1 1 1 1 0 2 0 2 0 1 1 1 0 1 0 2 1 2 0 1 1 0 2 1 2 2 2 0 0 2 2 2 0 1...

output:

0

result:

ok 

Test #35:

score: 0
Accepted
time: 92ms
memory: 101524kb

input:

200000
2 1 2 0 2 1 2 1 2 1 1 1 2 1 2 1 2 1 1 1 1 2 0 1 2 1 1 2 1 2 2 2 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 1 1 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 2 2 1 1 2 2 1 1 2 1 2 1 1 2 1 2 2 2 1 1 1 2 2 2 2 1 1 1 2 1 1 2 1 1 2 1 2 2 2 2 1 1 2 1 2 2 1 1 1 2 1 1 1 2 0 2 1 2 2 1 1 2 2 2 2 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2...

output:

0

result:

ok 

Test #36:

score: 0
Accepted
time: 88ms
memory: 99876kb

input:

200000
2 2 0 2 2 0 0 0 0 0 2 2 2 2 0 2 2 2 2 1 0 2 0 2 2 0 0 2 2 0 0 2 2 1 0 2 0 2 0 0 2 1 0 0 0 2 0 0 0 2 2 0 2 0 2 2 0 0 0 0 2 0 0 2 0 2 0 2 0 2 2 2 2 2 0 2 2 2 2 0 0 0 0 0 2 0 2 2 0 2 0 0 2 0 0 2 2 2 0 2 0 2 2 0 2 2 2 0 0 2 0 1 0 2 0 2 2 0 2 2 2 0 2 2 0 2 0 2 0 2 0 0 0 0 2 0 0 2 0 0 0 2 0 0 0 2 0...

output:

0

result:

ok 

Test #37:

score: 0
Accepted
time: 96ms
memory: 101212kb

input:

200000
1 0 0 1 2 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 2 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 0 1 0 0 0 0 0 1 2 1 0 1 1 1 1 0 1 2 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 1 0 1 0 1 0 1 0 1 2 1 0 0 1...

output:

598441952

result:

ok 

Subtask #4:

score: 16
Accepted

Test #38:

score: 16
Accepted
time: 2ms
memory: 14096kb

input:

3
1 1 1
0 1
1 2
100
2 0
0 0
0 2
2 1
0 1
0 0
0 1
0 0
1 0
2 2
0 1
0 0
0 1
1 1
0 0
2 0
2 1
2 2
0 2
2 1
2 2
2 0
0 1
2 1
0 2
0 1
2 0
2 1
0 0
2 0
2 1
2 2
0 2
2 0
0 0
2 1
2 0
2 2
1 2
0 1
1 1
2 1
0 0
0 2
0 1
0 0
1 2
1 0
1 2
1 0
0 1
2 2
2 1
2 2
0 2
1 2
2 1
0 0
0 2
0 1
1 1
2 0
0 0
1 2
0 2
0 0
1 0
0 1
0 2
2 1
...

output:

0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0

result:

ok 

Test #39:

score: 0
Accepted
time: 0ms
memory: 14064kb

input:

4
2 2 2 0
0 1
1 2
2 3
100
0 0
3 2
1 1
3 1
0 2
2 0
1 0
3 0
0 1
1 2
0 0
3 2
3 1
1 0
3 2
3 0
3 1
1 2
3 2
0 1
2 2
2 1
1 0
1 1
1 0
3 0
0 2
1 2
0 0
3 1
1 0
2 0
3 0
2 2
3 2
0 2
0 1
3 1
2 1
3 0
1 2
2 2
3 2
2 1
1 1
3 1
1 2
2 0
0 2
1 1
0 1
3 0
2 2
0 2
0 0
1 0
3 1
2 1
0 2
2 2
0 0
0 1
3 0
2 1
1 2
3 1
3 2
1 1
2 ...

output:

0
0
0
2
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
2
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 

Test #40:

score: 0
Accepted
time: 3ms
memory: 18132kb

input:

5
0 1 0 2 1
0 1
1 2
2 3
3 4
100
1 0
4 2
3 1
2 2
2 0
4 1
1 2
3 0
3 2
3 1
1 0
1 2
2 2
4 2
1 1
4 0
2 0
0 2
2 1
0 1
3 2
1 0
4 1
3 0
4 0
3 2
2 0
0 0
2 1
0 2
0 1
4 1
3 0
0 2
4 2
2 0
2 1
4 0
1 2
4 1
1 0
3 2
0 0
2 0
2 2
4 2
3 1
3 0
0 2
1 2
0 0
2 1
3 2
2 0
2 2
0 1
2 0
3 1
0 0
4 0
2 2
1 0
2 1
3 2
4 2
1 1
4 1
...

output:

1
0
0
3
2
3
0
0
0
0
0
0
0
0
1
3
2
0
3
3
0
0
1
1
0
0
1
0
0
2
2
1
1
0
1
2
0
2
2
4
2
1
1
2
0
0
0
2
0
0
0
0
2
2
0
0
0
0
1
2
1
2
1
0
2
4
4
2
1
2
4
2
0
2
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
2
1
0
1
0
0
0
3
0
0
2

result:

ok 

Test #41:

score: 0
Accepted
time: 2ms
memory: 14040kb

input:

6
0 1 2 0 1 2
0 1
1 2
2 3
3 4
4 5
100
2 1
5 1
5 2
1 2
2 2
3 2
2 1
0 2
3 1
3 0
0 1
0 0
3 2
5 1
4 2
1 0
0 1
5 0
1 2
5 1
5 2
4 0
0 0
0 2
2 2
0 0
1 0
2 0
0 1
1 2
2 2
2 0
2 1
1 1
4 1
3 0
1 0
3 1
0 0
5 0
1 1
2 0
2 1
2 0
4 2
3 0
1 2
4 0
2 1
3 1
3 2
2 2
3 0
4 1
5 1
5 0
4 2
3 2
2 1
4 0
5 1
2 0
1 1
1 0
4 1
3 ...

output:

4
4
0
4
4
2
1
3
0
0
3
2
4
3
1
2
4
2
2
1
0
0
1
3
2
0
0
0
0
0
0
0
0
1
0
0
1
3
3
6
0
0
0
0
0
3
1
0
0
3
4
3
0
0
2
0
2
0
0
3
3
2
0
1
0
0
0
0
4
4
3
4
4
4
3
2
2
2
3
0
0
2
0
0
0
0
0
0
2
4
3
2
1
0
1
0
0
1
2
3
6

result:

ok 

Test #42:

score: 0
Accepted
time: 4ms
memory: 16164kb

input:

400
0 2 2 1 0 2 2 1 2 0 1 2 0 0 2 1 2 0 1 0 2 2 0 2 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 2 1 2 2 1 0 1 1 2 0 1 2 0 2 1 2 1 1 2 1 1 0 1 0 2 2 2 2 1 0 1 0 0 0 2 2 0 2 1 1 0 0 0 1 1 1 0 0 2 0 0 2 0 1 2 1 1 0 1 2 1 0 1 0 1 1 0 1 2 0 1 0 2 2 1 0 0 1 0 2 1 2 0 1 1 1 0 1 1 0 1 0 2 0 1 1 2 0 2 2 2 2 2 0 1 0 0 2 2 ...

output:

748492
751280
745592
746546
748685
749066
748286
746439
742602
741927
739801
738044
740003
732801
732137
732791
741037
740750
744502
744511
744015
746300
749460
745730
745106
751192
750538
754769
756253
757792
760457
756172
757024
761186
760814
761345
762058
764833
769148
767330
764502
764339
767930...

result:

ok 

Test #43:

score: 0
Accepted
time: 13ms
memory: 19404kb

input:

4000
1 1 1 2 0 2 2 1 1 2 0 1 0 1 2 0 1 1 1 1 1 0 0 0 2 2 1 2 2 0 1 2 0 0 2 0 1 0 2 1 2 0 0 0 0 2 0 2 2 1 0 2 2 2 2 1 0 2 1 0 1 1 2 1 0 0 0 2 1 1 0 1 0 1 2 2 2 1 0 1 2 0 2 2 1 2 1 0 1 1 0 1 0 0 2 0 2 2 1 0 1 2 0 2 1 1 0 2 1 2 2 0 0 0 1 2 0 2 1 2 0 0 2 1 1 2 1 1 0 2 1 0 2 0 1 1 0 0 0 0 2 0 2 1 2 0 0 2...

output:

791220194
791202818
791448703
790793734
790538710
790399232
790680228
790274544
789587326
789569532
789589951
789568904
789520169
789458372
789475557
788952064
788936826
788957112
788606079
788625706
788314564
788853784
788476658
788033878
787760817
787604725
787949498
787930696
787950912
787946164
...

result:

ok 

Test #44:

score: 0
Accepted
time: 89ms
memory: 133516kb

input:

200000
1 2 0 2 1 2 1 1 0 1 1 1 0 1 2 0 2 1 2 1 1 0 0 0 0 2 2 2 0 0 1 1 1 2 1 0 0 2 2 0 2 1 0 2 0 0 1 1 2 2 0 2 0 0 1 1 2 2 0 2 1 1 1 1 0 2 0 1 1 0 2 0 0 2 1 0 2 2 2 0 0 2 0 2 0 2 2 1 2 1 1 2 0 1 0 0 2 0 2 2 1 0 0 2 1 0 2 0 2 1 0 2 1 0 2 0 0 0 0 0 2 0 0 2 2 1 0 2 0 2 1 2 1 2 2 2 0 2 0 0 0 0 2 1 0 0 1...

output:

98878415111108

result:

ok 

Test #45:

score: 0
Accepted
time: 98ms
memory: 133532kb

input:

200000
1 2 2 1 2 2 2 2 1 2 1 1 2 2 1 2 1 1 2 2 1 2 1 2 2 2 1 2 1 1 2 2 1 1 2 1 1 1 1 2 2 2 2 1 2 2 1 2 2 1 2 2 2 2 1 1 2 2 1 2 1 2 2 1 1 2 2 1 1 1 2 1 2 2 1 2 2 1 2 2 2 2 2 2 1 0 1 1 1 2 2 1 0 2 1 2 2 2 1 1 1 2 1 2 2 2 2 2 2 2 1 2 2 1 1 1 1 0 1 1 1 2 1 2 2 1 1 1 2 2 2 2 1 1 2 2 2 1 2 1 1 1 1 1 2 2 2...

output:

18725807625786

result:

ok 

Test #46:

score: 0
Accepted
time: 80ms
memory: 132680kb

input:

200000
0 2 2 2 0 2 0 2 0 2 0 0 0 0 2 0 2 2 0 2 0 0 2 2 2 2 2 2 0 2 2 0 0 0 0 0 0 0 2 0 0 1 2 0 2 2 2 0 2 0 0 0 2 0 0 2 2 0 2 0 0 0 0 0 2 2 2 0 0 0 2 2 0 0 0 0 2 0 2 0 1 2 2 0 0 2 0 2 0 2 2 0 2 0 2 0 0 2 0 0 0 2 0 0 0 2 0 2 0 0 2 0 0 2 0 2 0 2 2 2 0 0 2 0 2 2 2 2 1 0 0 0 2 2 0 2 0 2 0 2 2 2 0 0 0 0 0...

output:

19001142419904

result:

ok 

Test #47:

score: 0
Accepted
time: 101ms
memory: 134076kb

input:

200000
0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 1 0 1 1 0 1 0 1 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 1 0 1 1 0 0 0 1 2 2 1 0 0 1 0 2 1 2 1 2...

output:

19038058071323

result:

ok 

Test #48:

score: 0
Accepted
time: 133ms
memory: 75828kb

input:

100000
0 2 1 1 0 2 0 0 2 2 2 2 0 0 1 1 0 2 2 2 0 2 1 2 1 0 2 0 0 2 0 1 0 1 2 0 0 2 2 1 0 2 2 1 0 2 1 0 2 1 2 0 2 0 1 2 1 0 2 0 1 0 1 0 0 0 0 2 1 2 0 1 1 0 1 0 0 2 2 0 2 1 0 2 2 1 2 0 1 0 2 1 2 0 2 0 0 0 0 2 1 1 0 1 1 2 2 1 2 0 1 1 1 1 0 0 2 2 2 2 2 2 0 2 2 1 0 1 0 0 1 0 0 1 1 2 1 1 2 1 1 0 1 1 2 0 0...

output:

12305851592762
12305852134900
12306133507778
12305866995960
12305585087263
12305866995960
12305585642746
12305866995960
12305585642746
12305866995960
12305585642746
12305583154618
12305582570257
12305583154618
12305864493268
12305582570257
12305583154618
12305864493268
12305863525808
12305581608077
...

result:

ok 

Test #49:

score: 0
Accepted
time: 110ms
memory: 72736kb

input:

100000
1 2 0 2 2 1 2 0 2 1 1 0 0 1 1 2 2 1 2 1 1 1 0 0 0 2 1 2 1 2 1 1 0 0 1 2 1 0 1 1 1 0 0 2 2 2 0 1 2 2 1 0 1 0 1 2 0 0 0 2 0 1 0 2 0 2 2 0 0 0 1 2 1 1 1 0 1 2 2 1 2 0 1 0 0 2 0 0 2 2 1 2 1 1 2 2 2 2 2 0 2 2 0 0 0 0 2 0 2 2 1 0 1 2 1 1 0 2 2 1 0 1 2 1 1 2 2 2 0 1 2 2 1 2 1 2 2 0 0 1 1 1 0 2 2 1 2...

output:

12301813256756
12302373157130
12301813256756
12302373157130
12302924262596
12302925522835
12302374383909
12302373157130
12301813256756
12302373157130
12302374383909
12301813256756
12302367485243
12302364362222
12302924262596
12302364362222
12302367485243
12301813256756
12302364362222
12302925522835
...

result:

ok 

Test #50:

score: 0
Accepted
time: 164ms
memory: 75756kb

input:

100000
2 2 2 2 1 0 2 1 2 1 1 2 0 1 1 2 1 1 0 2 1 0 1 1 1 1 1 1 0 0 0 0 1 2 1 2 0 1 0 2 0 2 0 1 0 1 2 1 0 1 1 1 2 0 1 0 0 2 0 0 1 2 1 0 1 2 1 1 2 2 2 1 1 0 1 2 1 0 0 0 0 0 0 0 0 2 1 1 2 0 0 0 0 0 1 1 1 2 0 2 1 2 1 1 1 0 2 1 0 1 0 0 2 2 2 2 2 2 1 0 2 2 0 2 2 0 0 1 2 2 0 2 1 2 1 1 2 1 2 1 1 2 2 1 2 1 0...

output:

12418513167989
12418318171086
12418165193041
12418160409001
12418126763330
12418040055626
12418267377528
12418272506223
12417820448436
12417972199669
12417773522932
12417576059620
12417757013704
12417825430253
12418053743032
12418508820771
12418503688442
12418439828326
12418689699116
12418838558201
...

result:

ok 

Test #51:

score: 0
Accepted
time: 149ms
memory: 75832kb

input:

100000
2 1 2 1 2 2 1 1 1 1 2 1 2 1 1 2 2 1 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 1 1 2 1 2 2 2 2 1 1 2 2 1 2 1 2 1 2 1 2 1 1 1 1 2 2 2 2 2 1 2 1 2 2 1 2 1 2 2 1 1 1 1 0 2 1 2 1 2 2 1 1 2 2 2 1 1 0 1 2 1 1 1 1 2 1 1 1 1 2 2 1 1 1 2 0 1 2 2 2 1 2 1 2 1 1 1 1 1 2 1 1 1 0 1 1 1 1 1 1 2 2 2 2 2 1 1 2 2 1 2 1 2 1...

output:

2346723587578
2346797006215
2346772375460
2346809727919
2347690734887
2347721226196
2347677034956
2347711403087
2347703419765
2347769503612
2347741902138
2348263987234
2348275750601
2348310490766
2348282698683
2348245269554
2348276304355
2348288123222
2348310435745
2348929711544
2348877359493
234885...

result:

ok 

Test #52:

score: 0
Accepted
time: 144ms
memory: 75860kb

input:

100000
2 0 2 2 2 2 2 2 2 2 0 0 2 0 2 0 2 2 0 2 0 0 0 0 0 1 2 0 1 0 2 2 0 2 0 2 0 2 2 0 0 0 2 0 2 2 2 0 2 0 0 2 2 0 0 2 2 2 2 0 0 0 0 0 2 0 0 2 0 2 0 0 2 2 0 2 2 0 2 0 0 0 2 0 2 2 0 2 0 2 1 2 0 0 0 0 0 0 0 1 2 0 0 0 0 2 0 0 0 2 2 0 0 0 0 0 0 0 2 2 2 2 2 0 2 0 2 0 2 0 1 2 2 2 0 0 2 0 2 2 0 2 2 0 2 2 2...

output:

2400462386571
2400462158148
2400461544795
2400461889958
2400461185189
2400461548434
2400461920357
2400461234560
2400460695567
2400460511380
2400459879735
2400460424304
2400460567413
2400460041056
2400459736037
2400459512574
2400459660195
2400459345806
2400575350120
2400575946924
2400575378804
240057...

result:

ok 

Test #53:

score: 0
Accepted
time: 143ms
memory: 78004kb

input:

100000
0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 1 0 0 0 0 2 1 0 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 0 1 0 0 0 0 1 0 1 1 0 1 0 1 0 0 0 1 1 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 0 0 1 0 1 0...

output:

2323745275743
2323777633776
2323806469161
2323833154157
2323840493310
2323808770580
2324765240403
2324758452482
2323776601856
2323753628594
2323785579860
2323750302594
2323802364215
2323774143294
2323758276966
2323764116183
2323699833384
2324252351662
2324767071839
2324755050915
2324753777905
232472...

result:

ok 

Test #54:

score: 0
Accepted
time: 279ms
memory: 133776kb

input:

200000
1 1 0 2 1 2 1 2 2 0 1 0 2 1 1 1 2 2 2 1 0 2 2 1 2 1 0 0 1 2 1 0 1 1 2 2 0 1 1 0 1 2 2 1 2 2 0 1 2 0 2 0 2 1 0 0 1 2 2 1 1 0 1 2 0 1 1 2 1 0 2 1 0 2 2 2 0 1 0 2 2 0 0 0 2 1 2 1 0 0 1 2 1 1 0 0 1 2 0 2 1 2 1 0 2 1 2 2 1 0 0 1 0 2 2 2 1 0 1 1 0 2 2 1 1 0 2 2 2 0 0 0 1 0 2 0 1 2 1 1 1 0 0 0 2 1 0...

output:

98436910774628
98435790492478
98436353021634
98437473264408
98435641752233
98434521544912
98435641752233
98435650540959
98434527058080
98432660574726
98432663853112
98432964316426
98432961059499
98432964316426
98432961059499
98432964316426
98434084562142
98432964316426
98434084562142
98432873827394
...

result:

ok 

Test #55:

score: 0
Accepted
time: 220ms
memory: 131084kb

input:

200000
0 1 2 1 1 2 2 2 2 1 2 1 2 0 0 2 1 1 2 0 2 2 1 2 0 1 2 2 2 2 2 1 2 0 2 2 1 1 0 2 1 2 1 0 2 0 2 1 0 2 2 1 1 1 2 2 2 0 0 1 0 2 1 0 0 0 2 1 0 1 0 0 2 1 2 2 1 2 0 2 2 2 2 2 0 1 2 0 1 1 2 2 0 2 2 1 1 0 2 0 2 1 1 0 1 2 0 2 1 1 1 0 0 1 2 2 0 2 0 1 0 0 2 0 2 1 0 1 0 2 1 2 0 2 0 0 0 1 1 1 1 1 1 1 0 2 1...

output:

98656322568720
98654089382763
98656300074379
98654089382763
98656300074379
98654089382763
98656322568720
98656332308779
98654099189422
98656309947638
98656300074379
98654084729795
98656309947638
98656300074379
98654089382763
98651874038179
98654099189422
98654089382763
98654099189422
98656332308779
...

result:

ok 

Test #56:

score: 0
Accepted
time: 327ms
memory: 132576kb

input:

200000
0 1 0 2 1 0 2 1 2 0 1 2 2 0 1 2 0 0 1 0 0 2 0 0 1 1 0 0 1 0 2 0 0 1 0 2 2 1 2 0 2 2 0 2 2 1 0 0 0 2 1 1 1 2 1 2 0 2 2 1 2 1 2 0 1 2 0 1 1 0 0 0 1 1 2 2 2 1 2 0 1 0 1 0 0 2 2 1 1 2 1 2 0 2 1 0 2 2 1 1 2 1 1 0 0 0 1 2 0 0 1 1 0 2 2 0 0 0 1 2 1 2 0 2 1 2 2 0 1 2 1 2 1 1 1 0 1 0 2 0 1 1 0 0 0 1 1...

output:

98966103892595
98967140571022
98967143550915
98967142609596
98966185678400
98966421102932
98965911821926
98965913407716
98965918104910
98965913417511
98965122079850
98965524762266
98965522367911
98966328834972
98966123179251
98966127823396
98967012540625
98969031950525
98969028633876
98967004001828
...

result:

ok 

Test #57:

score: 0
Accepted
time: 396ms
memory: 130928kb

input:

200000
0 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 0 1 2 1 1 2 2 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 2 0 1 1 2 1 2 1 2 2 1 1 1 2 1 2 2 2 1 1 1 2 1 2 1 2 1 2 2 1 2 2 2 2 2 1 2 1 1 1 1 1 2 2 1 2 2 2 1 2 2 2 2 0 2 2 2 2 1 2 1 1 1 2 1 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 2 2 2 1 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 1...

output:

18697396764912
18695300327400
18695417492428
18695412390750
18695497770485
18695645619754
18695621483891
18695621059672
18695547575010
18695796159440
18697905632033
18697974160176
18697990665232
18698059102482
18700429463664
18700271546880
18700128236136
18700269015812
18700479008398
18700459208097
...

result:

ok 

Test #58:

score: 0
Accepted
time: 285ms
memory: 131136kb

input:

200000
2 2 0 2 2 2 2 2 0 2 2 2 0 2 2 2 0 0 1 2 0 2 0 2 0 0 2 0 0 2 0 0 0 2 0 2 0 2 0 2 2 2 2 0 0 1 0 0 0 0 0 0 0 2 0 0 0 2 0 2 0 0 0 0 0 0 1 0 1 0 2 0 2 2 0 2 2 0 2 2 0 2 0 2 2 0 0 0 0 2 2 2 2 0 2 0 2 2 0 2 0 0 2 2 2 2 0 2 2 2 2 0 0 0 0 0 0 2 0 2 0 0 2 0 2 2 2 0 2 2 0 2 0 2 2 2 0 0 0 2 2 2 0 2 0 0 0...

output:

19301561644377
19301561010923
19301560519357
19301560658860
19301560141868
19301560283528
19301560403681
19301560821780
19301561367932
19301560929964
19297228945278
19297228845345
19297228942726
19297228773359
19297229163546
19297229516549
19297229611392
19297228960187
19297229206178
19297229572763
...

result:

ok 

Test #59:

score: 0
Accepted
time: 334ms
memory: 132580kb

input:

200000
1 0 1 0 0 2 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 2 2 1 0 1 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 1...

output:

18631796300984
18631687250817
18631856709119
18631764152424
18631788410608
18631743814247
18631869669973
18631874454986
18631609360317
18633884518788
18633849370968
18633712111542
18633473133941
18633515779302
18633579888709
18633651258564
18633894929986
18634024209976
18634169079793
18634278683400
...

result:

ok 

Subtask #5:

score: 16
Accepted

Test #60:

score: 16
Accepted
time: 3ms
memory: 14068kb

input:

3
2 0 0
0 1
0 2
100
0 1
2 2
2 1
1 1
0 0
2 2
1 2
0 2
0 1
0 0
0 1
0 2
2 1
1 0
2 2
2 0
0 0
0 2
1 1
1 2
2 2
2 1
0 0
2 2
0 1
1 0
0 0
2 0
1 1
1 0
2 1
2 0
0 2
0 1
2 2
1 1
0 0
0 1
2 1
0 0
2 0
0 1
2 1
2 0
0 2
2 2
0 1
2 0
0 0
0 1
2 1
0 2
0 1
0 2
2 2
1 0
1 1
1 2
1 0
1 2
1 0
0 0
1 1
0 1
1 0
2 0
1 2
1 0
0 2
0 0
...

output:

0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 

Test #61:

score: 0
Accepted
time: 0ms
memory: 12288kb

input:

4
1 0 1 0
0 1
0 2
1 3
100
0 2
3 2
1 1
0 1
3 1
3 2
3 1
2 2
1 2
2 1
1 0
2 2
3 2
3 1
1 1
3 2
2 0
3 1
0 2
1 2
2 1
2 2
0 1
1 0
3 0
3 2
3 1
3 0
0 0
2 0
1 1
1 2
0 1
1 0
2 2
2 1
1 1
3 2
0 0
2 2
0 1
3 1
1 0
2 1
2 0
1 2
0 2
3 0
3 1
0 1
0 2
3 2
3 1
1 1
1 0
2 2
0 0
0 1
0 0
0 1
0 0
2 0
0 1
3 2
0 2
3 0
2 2
2 1
3 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
2
0
0
0
0
0
0
1
2
1
1
2
0
0
0
0
1
0
2
0
0
0
1
1
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
2
1
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 

Test #62:

score: 0
Accepted
time: 4ms
memory: 18428kb

input:

5
1 0 0 1 1
0 1
0 2
1 3
1 4
100
0 0
0 2
1 1
3 0
3 2
1 0
2 1
0 0
1 2
4 0
0 2
1 0
2 0
1 1
1 0
1 2
3 0
1 0
0 1
0 0
4 1
4 2
3 1
2 1
4 0
3 2
3 1
2 0
2 1
2 0
0 2
2 1
0 0
2 2
1 1
0 2
3 2
4 2
1 2
2 1
0 0
2 0
1 0
0 1
2 2
3 0
3 2
2 0
0 2
1 2
3 1
2 1
4 1
2 2
0 0
0 2
1 0
2 1
4 0
1 2
1 0
1 2
2 0
2 1
0 0
4 1
1 0
...

output:

0
0
0
0
1
1
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
2
3
0
0
0
0
0
0
2
1
2
1
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
2
0
0
2
1
0
1
3
0
0
0
0
0
0
0
0
0
1
2
0

result:

ok 

Test #63:

score: 0
Accepted
time: 2ms
memory: 16048kb

input:

6
2 1 0 2 1 2
0 1
0 2
1 3
1 4
2 5
100
5 1
4 0
3 1
5 2
4 2
2 1
2 0
2 1
5 0
3 0
4 1
0 1
4 0
1 0
0 0
1 1
5 1
4 2
0 1
1 2
3 1
3 2
0 2
1 0
3 0
1 2
1 0
1 1
1 2
4 1
2 0
1 0
5 0
0 0
5 1
5 0
1 2
0 2
5 2
0 0
3 2
3 0
3 2
3 1
0 2
4 0
5 1
4 1
3 0
5 2
3 1
4 0
1 1
5 1
2 2
5 2
5 1
3 2
0 0
0 1
4 2
2 0
5 2
1 0
3 1
2 ...

output:

1
1
3
1
2
1
0
1
0
3
5
2
0
0
0
0
0
0
2
1
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1
2
3
2
3
3
3
0
4
4
3
2
2
2
1
0
0
0
2
2
2
4
2
4
2
2
0
0
0
0
0
0
3
3
3
3
2
2
2
0
0
3
0
0
0
0
0

result:

ok 

Test #64:

score: 0
Accepted
time: 0ms
memory: 18468kb

input:

400
1 1 1 0 1 0 2 2 0 0 2 1 2 2 1 2 2 1 1 1 2 1 0 1 2 0 0 1 0 0 1 0 1 2 1 2 1 2 0 0 1 1 0 2 1 1 1 1 0 2 2 1 2 0 0 1 1 2 1 2 1 1 0 0 0 2 0 2 2 0 1 2 0 2 0 1 0 0 2 2 1 0 2 2 2 2 1 2 1 1 2 1 2 2 2 2 0 0 2 1 2 0 1 1 1 1 0 1 1 0 2 0 0 1 1 1 1 0 1 2 0 2 1 2 1 1 1 0 0 0 2 2 1 0 1 0 0 1 2 1 1 2 0 2 0 1 1 2 ...

output:

81027
81548
82381
82262
82052
81837
81658
81443
82127
81941
82560
80316
79750
80735
80890
73382
73536
73359
73138
72918
72653
71997
72478
72672
72911
72261
72853
73213
72954
73769
74787
74121
73931
71563
71778
70747
70281
70114
67043
66640
66415
65849
66006
66629
66799
66844
71682
71874
72971
72416
...

result:

ok 

Test #65:

score: 0
Accepted
time: 11ms
memory: 18884kb

input:

4000
1 1 1 0 1 1 0 2 1 1 2 1 2 2 1 0 1 2 2 0 1 1 1 1 2 0 1 1 0 0 2 0 1 1 2 2 2 2 1 1 1 1 0 0 1 2 0 1 0 2 1 2 2 1 2 0 1 2 0 0 0 1 1 0 1 2 1 1 1 1 0 1 0 1 1 2 1 1 0 1 1 0 0 2 2 0 1 0 0 1 1 2 0 0 1 0 0 1 0 0 2 0 2 2 1 1 2 0 2 1 2 2 0 1 1 1 1 1 1 1 0 2 0 2 0 1 1 1 1 1 1 0 0 0 1 2 1 2 0 0 0 0 1 1 2 0 0 0...

output:

14132542
14132780
14127197
14127091
14141758
14141687
14141782
14142021
14142204
14134941
14142824
14142974
14140574
14140667
14180192
14184660
14184584
14184417
14184136
14167667
14167744
14167912
14167710
14167788
14174353
14182082
14181898
14186831
14198546
14205957
14196800
14206231
14206053
141...

result:

ok 

Test #66:

score: 0
Accepted
time: 90ms
memory: 113480kb

input:

200000
0 1 1 2 2 0 2 2 0 2 0 2 1 1 2 1 1 0 1 1 1 2 1 1 0 1 1 0 2 2 1 0 1 0 1 0 0 1 2 1 1 0 0 1 1 1 1 0 2 0 2 1 0 2 2 0 2 0 0 1 1 1 2 1 0 0 1 0 2 2 2 1 1 2 1 0 0 1 0 2 1 0 1 1 1 2 1 0 1 1 2 2 2 1 2 2 0 1 1 1 2 0 0 2 0 1 0 1 0 2 0 2 1 2 2 1 0 0 0 2 1 2 0 0 1 2 2 1 1 1 0 0 1 2 2 2 2 0 0 1 1 0 1 0 1 2 2...

output:

44705759734

result:

ok 

Test #67:

score: 0
Accepted
time: 76ms
memory: 113508kb

input:

200000
1 1 2 1 2 0 2 2 1 2 1 2 1 2 2 2 2 2 2 2 1 1 1 1 2 2 1 1 2 1 1 2 2 2 2 1 2 1 2 1 1 1 1 1 0 2 2 1 1 2 1 1 1 2 1 1 1 1 2 1 1 1 0 1 2 1 2 2 2 1 1 2 1 1 1 2 2 2 1 1 2 1 2 2 2 1 1 2 2 1 2 1 1 1 0 0 1 2 1 1 2 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 2 2 1 1 1 2 2 1 2 1 1 2 2 1 1 1 2 2 2 2 1 1 2 1 2 2 1 0...

output:

8081399556

result:

ok 

Test #68:

score: 0
Accepted
time: 88ms
memory: 111480kb

input:

200000
0 2 2 0 2 2 2 2 2 2 0 2 0 2 0 0 0 0 2 0 0 0 2 0 0 2 1 2 0 2 0 0 0 2 0 0 2 0 2 2 2 2 2 0 0 2 1 0 0 2 2 2 2 0 0 2 2 0 2 0 2 2 0 2 0 2 2 0 0 0 0 2 2 2 2 2 0 2 0 0 2 2 2 0 2 2 0 2 0 0 2 0 2 2 2 0 2 2 0 2 0 2 0 2 2 0 0 2 0 2 2 0 0 0 0 2 2 2 0 2 0 2 2 0 1 0 0 0 0 0 2 0 0 0 2 1 0 0 2 2 2 2 2 0 2 2 1...

output:

7578518269

result:

ok 

Test #69:

score: 0
Accepted
time: 83ms
memory: 113580kb

input:

200000
1 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 2 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 2 1 0 0 1 1 0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 2 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 2 0 1 1 1 1 0 1 0 0 2 0 0 0 0 1 0 1 0 1 0...

output:

7842611505

result:

ok 

Test #70:

score: 0
Accepted
time: 207ms
memory: 62652kb

input:

100000
0 2 0 0 0 0 2 2 1 1 2 1 1 1 0 2 1 2 1 1 2 1 2 2 1 0 0 0 2 2 1 2 2 2 2 2 2 0 1 2 0 2 1 1 0 1 2 0 2 0 2 0 2 0 2 0 0 1 0 0 0 1 2 2 1 0 2 0 1 2 0 0 2 2 1 1 0 1 2 2 0 1 2 1 0 2 0 0 0 0 0 0 1 0 1 1 0 0 1 2 1 0 2 2 2 0 2 0 2 0 1 2 1 2 1 2 0 1 1 2 2 2 1 1 2 2 2 2 1 0 2 2 2 1 2 2 1 1 2 0 0 1 1 2 1 0 2...

output:

8821295872
8821296147
9564139052
8821295872
8821295681
9564138785
9564557503
9564371980
8821528877
8821295963
8821273000
8821273290
8821273000
9564071254
8821273290
9564071254
8821273000
8821273290
9564071254
8821273290
8820974722
9563750804
8820974722
8820974425
9563750804
8820974722
8821039686
882...

result:

ok 

Test #71:

score: 0
Accepted
time: 402ms
memory: 66576kb

input:

100000
1 0 2 1 0 2 2 0 2 2 2 2 2 0 2 1 1 0 1 1 1 1 0 1 2 1 1 2 2 2 2 2 0 1 1 2 1 1 2 0 1 1 1 1 2 0 0 1 2 0 2 0 1 2 2 1 2 2 2 2 1 2 0 2 2 0 1 1 1 1 2 0 1 1 1 2 1 1 0 2 2 2 1 1 0 2 2 1 2 2 1 2 1 2 1 1 2 0 1 1 2 1 2 1 1 1 2 0 1 2 0 1 0 2 0 0 2 2 0 0 1 1 2 0 1 1 1 1 1 0 0 2 1 2 2 0 1 1 0 0 2 1 2 2 0 0 0...

output:

9900828574
9901123105
9901558117
9901559863
9901561538
9901241053
9901243302
9900841539
9901073511
9900841551
9901224707
9900891827
9901193513
9901191456
9900859127
9900508225
9900868272
9900869818
9901103676
9901101160
9901405928
9901403850
9901736004
9902118965
9902402250
9902404114
9902169373
990...

result:

ok 

Test #72:

score: 0
Accepted
time: 404ms
memory: 66588kb

input:

100000
1 2 2 2 0 2 1 1 0 0 2 0 2 1 0 2 2 1 1 1 2 0 0 2 2 2 0 1 2 2 2 0 0 1 1 1 0 0 0 0 0 1 0 2 0 1 0 1 0 0 0 1 0 2 0 0 2 0 2 2 2 2 1 0 1 2 0 0 0 2 0 0 1 2 1 0 0 1 0 2 1 1 2 2 2 2 2 0 1 0 2 2 2 2 1 0 0 2 2 2 0 2 0 1 2 2 2 2 1 1 0 2 0 2 1 1 2 1 0 0 1 0 0 1 1 2 1 2 1 2 1 0 1 0 0 2 0 1 1 0 1 0 1 2 1 1 2...

output:

8866532903
8866266025
8866265404
8866264491
8865969722
8865968574
8865970233
8866204005
8865029098
8865196570
8865368030
8865370923
8865369538
8865168328
8865135093
8865385470
8865384250
8865383594
8865076149
8865313844
8865546375
8865244496
8864975343
8864974133
8864739724
8864740482
8864739477
886...

result:

ok 

Test #73:

score: 0
Accepted
time: 373ms
memory: 66664kb

input:

100000
1 2 2 0 1 1 2 1 2 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 2 2 1 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 1 1 1 1 1 2 2 2 0 2 1 1 2 1 2 2 2 2 1 2 2 2 2 2 1 1 1 1 2 2 2 1 1 1 2 1 1 1 1 2 1 2 2 2 1 1 1 1 1 1 2 1 1 1 2 1 2 2 1 2 2 1 1 2 2 1 2 1 1 1 2 2 2 1 1 2 0 1 2 1 2 2 2 1 1 2 2 1 1 1 2 1 2 2 1 1 1 1 1 2 2...

output:

1923134841
1923098761
1923068781
1923100856
1923136813
1923178461
1923151422
1923190446
1923139511
1923107348
1923142475
1923193068
1922471761
1922501746
1922531560
1922483959
1923074561
1923029924
1922988637
1923039300
1923012232
1923055404
1923709851
1924332573
1924291452
1924336408
1923841979
192...

result:

ok 

Test #74:

score: 0
Accepted
time: 341ms
memory: 64560kb

input:

100000
2 0 2 2 2 2 0 0 2 0 0 0 0 2 2 2 2 2 2 2 0 0 2 2 2 2 0 2 0 2 0 2 2 2 2 2 2 2 2 0 1 0 0 0 2 0 0 0 2 2 2 2 0 2 1 0 0 2 0 0 0 2 2 0 2 0 2 0 2 2 0 2 0 1 0 0 2 2 2 2 0 2 0 0 0 2 2 0 2 0 0 0 0 2 0 0 0 0 0 0 2 2 2 0 0 2 2 2 0 2 2 2 2 2 0 0 2 0 2 2 0 0 0 0 2 0 0 2 2 2 0 0 2 0 2 2 0 2 1 0 0 2 2 0 2 0 2...

output:

1525082875
1525082664
1525098402
1525098613
1525098402
1525098613
1525098666
1525098457
1530990775
1530990974
1530991108
1530990905
1530990702
1530990737
1530990721
1530990924
1530990945
1530990921
1531653395
1531653190
1531653395
1531653190
1531653147
1531653354
1531653381
1531653176
1531687363
153...

result:

ok 

Test #75:

score: 0
Accepted
time: 357ms
memory: 64508kb

input:

100000
0 1 0 1 1 1 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 1 0 1 1 2 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 0 2 1 1 1 0 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 0 1...

output:

2063072176
2063026328
2063571586
2064283826
2064244031
2064284088
2064324207
2063683556
2063638505
2063590631
2063627298
2063648635
2063605542
2063913146
2063956384
2063999436
2063960585
2063923816
2063883884
2063860177
2063893092
2063929914
2064077069
2064034617
2063988435
2064000191
2063960758
206...

result:

ok 

Test #76:

score: 0
Accepted
time: 485ms
memory: 113400kb

input:

200000
2 2 2 0 2 0 0 1 2 1 2 2 2 0 2 0 1 2 2 2 2 0 2 0 0 0 1 0 1 1 2 1 2 0 0 0 1 2 2 0 0 2 1 1 2 1 1 1 1 0 0 2 2 0 0 1 1 0 2 1 2 0 1 2 0 2 1 1 0 2 2 2 0 2 1 2 1 1 1 1 0 2 0 2 2 1 2 2 2 0 0 2 0 0 0 2 1 2 0 2 1 1 0 2 1 0 1 1 0 0 1 0 1 1 0 0 2 2 2 0 1 2 0 0 1 1 0 2 0 2 2 0 2 2 0 0 1 1 0 2 2 2 2 0 2 0 0...

output:

35803105614
38762344942
38761437962
35802153839
38761437962
38762063367
35802734800
35802734454
38762063367
35802734800
38762063367
38762064512
35802735377
38762064512
38762643916
35803270356
35803270016
38762643916
35803270016
35803268938
38762642614
35803268938
38762642614
35803269286
35803463662
...

result:

ok 

Test #77:

score: 0
Accepted
time: 891ms
memory: 111676kb

input:

200000
1 0 1 0 0 2 1 0 1 2 0 1 1 1 0 1 2 2 1 0 2 0 0 2 1 1 1 0 1 1 2 1 2 2 0 2 2 2 0 0 1 1 2 0 0 2 0 1 1 1 0 0 0 1 2 1 0 2 1 0 1 2 0 2 2 0 1 0 0 2 2 1 2 0 1 2 1 0 2 1 1 1 1 1 1 0 1 0 0 2 1 1 2 0 2 2 1 2 1 2 2 0 0 1 2 0 1 1 2 0 2 2 0 0 2 1 2 2 1 0 2 2 1 0 0 0 1 0 0 0 0 0 2 1 0 0 0 2 0 2 2 0 0 2 2 0 2...

output:

43444761896
43445433771
43445977597
43445201981
43445746105
43445006762
43445006666
43445724756
43445723551
43445121919
43445841023
43445839953
43445839539
43445839231
43446516618
43447290990
43448075191
43448075302
43447423180
43447834695
43447163589
43447706753
43447705667
43447704670
43446988668
...

result:

ok 

Test #78:

score: 0
Accepted
time: 831ms
memory: 111396kb

input:

200000
1 1 2 0 1 0 0 1 1 2 0 0 1 2 2 2 1 0 2 2 0 2 1 0 0 1 0 2 2 1 1 2 2 0 1 1 0 2 0 2 1 0 0 1 2 1 1 0 1 2 0 0 1 1 2 2 0 1 1 0 0 0 1 2 2 1 1 1 0 2 1 0 1 1 1 2 1 2 2 0 0 2 2 1 0 1 0 1 0 2 0 2 2 2 0 2 1 2 1 0 1 1 1 2 2 1 0 2 1 1 1 1 2 2 2 2 2 2 2 1 2 2 0 2 1 0 2 2 1 1 2 0 1 1 1 0 0 2 0 2 2 2 0 0 2 0 2...

output:

44897023717
44897026214
44896465355
44896591251
44896593006
44896590513
44895834212
44895368461
44894907040
44895640846
44895212634
44895677125
44894935040
44895723594
44896330327
44896326613
44896856238
44896170213
44895426076
44895423193
44895428090
44895426675
44895786854
44895241240
44894631441
...

result:

ok 

Test #79:

score: 0
Accepted
time: 894ms
memory: 113532kb

input:

200000
2 1 1 2 1 2 2 1 1 2 1 1 0 2 2 2 1 1 2 2 2 2 2 2 2 1 1 1 2 2 2 1 2 1 2 2 2 1 2 1 2 2 1 1 0 2 2 1 2 1 1 2 1 2 2 2 2 2 1 1 1 2 1 2 2 2 1 1 1 2 1 1 2 1 2 1 1 1 1 1 1 2 2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 1 2 2 2 1 1 1 0 1 2 2 1 1 2 1 2 1 1 1 2 2 2 1 2 1 2 2 1 2 2 0 2 2 1 1 2 1 1 1 1 1 2 1 2 1 2 2 2...

output:

8101789485
8101739494
8103558728
8103498085
8103578182
8103664670
8103590427
8103512505
8103596589
8103555534
8103628457
8103701618
8103629649
8103726089
8103641305
8103685315
8104669426
8104768182
8104683042
8104599420
8104685426
8104775423
8104866920
8104042681
8103946158
8104045127
8103977963
810...

result:

ok 

Test #80:

score: 0
Accepted
time: 832ms
memory: 113476kb

input:

200000
0 0 1 0 0 0 0 2 0 2 2 2 0 0 0 0 2 0 0 2 2 2 0 2 0 0 2 2 0 0 2 2 2 1 0 2 0 0 2 2 2 0 0 2 2 2 0 2 0 2 2 2 2 2 0 2 2 2 0 0 0 2 2 0 2 2 2 0 0 2 0 1 0 0 0 2 2 0 2 1 0 0 2 2 0 2 2 0 2 2 2 2 2 0 0 0 0 2 2 2 0 0 0 2 2 0 2 0 2 0 0 2 0 0 2 0 2 0 2 0 2 1 2 0 1 0 2 0 2 2 2 2 0 0 2 0 0 0 0 2 0 2 0 2 0 2 0...

output:

11328642689
11329157196
11329157389
11329157196
11329157003
11329157196
11329157033
11329157228
11329157389
11329157582
11329157338
11329157501
11329157338
11329157143
11329157593
11329157752
11329157481
11329157290
11329157455
11329157266
11329157433
11329157600
11329157785
11329157538
11329157701
...

result:

ok 

Test #81:

score: 0
Accepted
time: 903ms
memory: 111608kb

input:

200000
0 0 0 1 0 1 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 0 0 1 0 0 0 1 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 2 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 1 1 0 0 0 1 1 1 0...

output:

7202374285
7202488860
7202567943
7202610579
7202678643
7203651400
7203653724
7203779776
7203727143
7202795337
7202721296
7202788305
7203614354
7203691259
7203631682
7203564301
7203734098
7203722068
7203783310
7203872538
7203799847
7203858616
7203914809
7203824076
7203876720
7203805758
7203894616
720...

result:

ok 

Subtask #6:

score: 34
Accepted

Dependency #2:

100%
Accepted

Test #82:

score: 34
Accepted
time: 134ms
memory: 68888kb

input:

100000
2 1 0 2 1 2 2 2 0 1 2 1 1 2 1 2 1 1 1 1 1 0 1 0 0 1 0 1 1 2 0 1 2 1 0 1 2 2 2 1 0 1 0 2 1 1 2 0 1 0 0 2 0 2 2 2 2 1 0 2 0 1 1 2 2 2 0 2 1 0 1 1 0 1 1 0 1 1 1 2 2 0 2 1 1 2 0 0 0 2 0 2 2 1 1 2 2 1 2 2 1 0 2 0 1 2 2 1 1 1 2 2 1 1 1 2 0 0 0 0 1 0 0 0 2 0 2 0 0 2 1 0 0 2 2 2 0 1 1 1 1 1 0 1 0 0 1...

output:

9559281849549
9558726709272
9558729881442
9559281849549
9558726709272
9559281849549
9558729881442
9559281849549
9558729881442
9559281849549
9558726709272
9559281849549
9559183715845
9558884413811
9558329259230
9558343181485
9558898362995
9558346366933
9558349676690
9558901679573
9558349676690
955890...

result:

ok 

Test #83:

score: 0
Accepted
time: 157ms
memory: 69432kb

input:

100000
0 0 1 1 1 2 1 0 1 1 0 2 1 1 1 1 0 0 0 2 1 0 1 2 0 2 0 0 0 2 2 0 2 0 1 1 1 0 2 0 2 1 1 2 1 1 0 0 2 1 0 2 2 1 0 1 1 0 0 2 1 2 0 2 2 1 2 0 2 1 0 2 2 1 0 1 0 1 2 0 0 1 1 2 0 0 0 2 1 2 1 2 0 0 1 2 0 1 2 1 1 1 0 0 1 0 1 2 1 0 2 0 2 2 0 2 0 1 1 1 2 1 1 0 1 0 1 0 0 1 1 1 1 0 2 1 0 0 2 2 2 2 1 1 1 2 1...

output:

9596047596512
9595616104943
9596053532037
9595619499659
9595182072565
9594755235780
9595189245987
9595616104943
9595622020637
9595188010430
9595625415285
9595192640635
9595619499659
9595613541827
9595619499659
9595192640635
9595625415285
9595619499659
9595182072565
9594755235780
9595192640635
959562...

result:

ok 

Test #84:

score: 0
Accepted
time: 205ms
memory: 69296kb

input:

100000
2 1 2 2 0 0 1 1 1 0 0 2 0 0 2 0 0 2 1 2 2 2 0 0 2 0 2 0 0 1 2 0 1 1 0 0 1 0 0 2 0 0 2 0 1 2 0 1 1 1 2 1 0 1 0 0 2 0 2 1 2 1 1 0 1 2 0 0 2 2 1 2 1 2 1 1 2 2 2 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 2 0 2 1 2 0 1 1 2 1 2 1 1 2 0 2 2 2 1 0 0 2 1 1 2 2 0 1 2 1 0 0 2 1 0 2 2 0 2 1 1 0 0 1 1 2 0 2 0 0 2 0 1...

output:

9622694298497
9622741686310
9622812806952
9622385374356
9622418884136
9622421503780
9622420867340
9622420434599
9622420218943
9622422748226
9622422450342
9622422397283
9622169880867
9621998244485
9622205951428
9622011532374
9621602858583
9621832212874
9621831997132
9621807638552
9621958911257
962181...

result:

ok 

Test #85:

score: 0
Accepted
time: 187ms
memory: 71768kb

input:

100000
2 2 1 1 2 1 1 1 1 2 1 1 1 2 1 2 1 2 1 2 2 1 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 1 2 1 1 2 1 1 2 2 1 2 1 2 2 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 1 1 2 1 1 1 2 1 2 2 1 1 2 2 1 1 1 1 1 2 2 2 1 2 2 1 2 2 2 2 1 1 2 2 1 0 2 2 1 2 2 2 1 2 1 1 2 2 2 1 2 2 1 1 1 2 2 2 1 2 2 2 2 2 1 2 2 1 1 1 1 0 1 1 2 1 1 1 1 1...

output:

1772658133910
1772639782734
1772648903878
1772618082106
1772649217472
1772697652664
1772731157534
1772763191996
1772788201196
1772800273408
1772798905708
1772762384054
1772809290010
1772773292125
1773433797235
1773430197860
1773394126747
1773373709629
1773409559971
1773427138827
1773429214543
177341...

result:

ok 

Test #86:

score: 0
Accepted
time: 180ms
memory: 70168kb

input:

100000
2 2 0 0 0 0 0 0 2 0 2 2 2 0 0 0 0 2 0 0 0 2 0 2 0 0 2 2 2 0 2 2 0 1 2 2 2 2 0 0 2 2 2 2 0 2 0 2 0 2 2 0 0 0 2 2 0 0 2 0 2 2 2 2 2 2 0 0 0 2 2 0 0 0 0 0 0 2 2 2 0 0 0 0 0 0 2 0 2 0 0 2 0 2 0 0 0 0 2 2 2 2 2 0 2 2 2 1 2 2 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 0 0 2 2 2 2 0 0 0 2 2 0 2 2 2 2 2...

output:

1843753459322
1843753087792
1843752887582
1843753149703
1843753376437
1842907711904
1843928418693
1843928692910
1843928333235
1843928094156
1843927777974
1844670077790
1844669722756
1844670011062
1844670215928
1844670513830
1844670852422
1844670613096
1844670372198
1844670703956
1845582952910
184558...

result:

ok 

Test #87:

score: 0
Accepted
time: 214ms
memory: 68824kb

input:

100000
0 1 1 1 1 1 1 1 1 1 0 0 2 1 0 0 1 1 0 1 1 0 1 1 1 1 0 1 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 0 0 1 1 1 0 0 1 1 1 1 1 0 1 2 2 1 1 0 0 1 1 1 0 0 0 1 1 1 0 1 0 0 1 0 0 1 1 1 1 1 0 2 0 1 0 2 0 0 1 0 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 0 0 2 1 1 0 0 0 0 0 1 1 0 2 0 1 0 0 1 1 1 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 0 0...

output:

1819509716742
1819523711225
1819540834260
1819553383315
1819563838563
1819562574646
1819526028449
1819557687502
1819582585402
1818769577336
1819313617009
1819342800218
1819342227082
1818768476934
1818743031680
1818772634362
1818804432744
1818844001778
1818826931304
1818865298394
1818825092164
181878...

result:

ok 

Test #88:

score: 0
Accepted
time: 438ms
memory: 69464kb

input:

100000
0 0 0 2 1 1 2 1 0 1 2 2 2 0 1 1 0 2 0 1 2 1 1 0 1 0 1 2 2 2 1 0 2 1 2 0 2 1 2 0 0 2 0 1 1 2 2 0 1 2 0 2 2 1 1 1 2 1 2 0 0 2 1 1 1 2 1 1 0 2 1 1 1 0 1 2 1 0 2 1 1 2 1 1 2 0 2 2 0 1 0 0 2 0 0 0 2 2 0 2 0 0 0 0 0 2 0 0 0 2 2 1 2 0 1 2 2 2 2 2 2 0 0 1 2 1 1 1 1 0 2 1 2 0 0 1 0 2 1 0 2 2 1 2 2 2 0...

output:

85533161552
85530394278
85527900114
85525331224
85522844128
85525611360
85528304613
85530708556
85530692903
85527908072
85530565223
85533241447
85535788637
85533232941
85533217460
85535938670
85533159843
85530417127
85527677728
85530322861
85533020406
85535709872
85538183615
85536297229
85538975445
...

result:

ok 

Test #89:

score: 0
Accepted
time: 419ms
memory: 69456kb

input:

100000
1 0 1 0 0 1 0 2 1 2 0 2 1 2 2 2 0 1 2 1 0 2 1 1 2 0 0 0 2 1 2 0 1 2 2 0 0 2 1 2 1 2 2 1 0 1 1 1 0 1 2 1 1 0 0 0 2 2 1 2 2 1 0 2 2 0 2 0 2 2 0 2 1 1 2 1 1 1 0 2 2 0 0 1 2 0 2 1 1 1 0 2 1 0 1 2 2 1 0 2 0 0 1 0 2 0 1 1 2 0 2 0 2 1 0 0 2 0 0 0 0 0 0 2 0 0 0 2 1 0 0 1 0 0 0 1 2 2 0 2 0 2 2 0 2 2 0...

output:

88163490600
88160808346
88160823013
88160806597
88163278177
88160659295
88160650228
88160632339
88158778956
88158767343
88158788337
88156045885
88158477899
88161276306
88163944130
88161470349
88161489759
88158923131
88158900690
88158880553
88156266829
88156277772
88158744340
88156157169
88153483056
...

result:

ok 

Test #90:

score: 0
Accepted
time: 457ms
memory: 69144kb

input:

100000
1 1 2 1 0 2 1 1 2 2 0 2 1 1 2 0 0 1 2 2 0 1 0 0 0 1 2 2 1 2 0 0 2 2 0 1 2 0 0 1 2 1 0 2 0 2 0 0 1 1 2 0 2 1 0 1 0 1 2 0 2 1 1 2 0 1 1 2 1 0 0 2 2 1 1 2 0 1 1 1 0 2 0 2 2 2 2 0 0 2 2 2 0 0 0 2 0 1 1 1 0 2 0 0 0 1 2 0 1 2 0 0 2 1 1 1 0 2 2 1 1 2 2 0 2 2 0 0 0 0 2 1 0 0 2 1 1 0 1 2 2 2 1 0 2 1 1...

output:

29984838387
29985755560
29985756841
29984806281
29985878178
29986890992
29986890294
29985914110
29985913709
29986824656
29985753613
29986630132
29987705519
29986903166
29987877242
29987878744
29987038858
29986095385
29986094477
29985114036
29985115301
29985918815
29985918476
29985047769
29985952726
...

result:

ok 

Test #91:

score: 0
Accepted
time: 442ms
memory: 69716kb

input:

100000
0 0 2 1 1 2 2 0 1 1 0 2 0 0 2 2 1 1 1 2 2 1 2 0 1 1 1 0 2 1 0 1 0 1 0 1 1 1 0 2 0 1 0 2 2 2 2 0 2 0 2 1 2 1 1 0 0 0 2 0 0 2 1 2 2 0 2 2 2 2 0 0 0 1 0 1 1 0 2 1 0 0 2 2 0 1 1 1 2 0 0 2 0 0 1 2 1 2 2 2 1 2 0 2 0 2 0 1 1 0 2 1 0 0 1 0 1 2 2 2 0 0 1 1 1 0 0 0 0 2 0 2 1 1 2 0 1 0 0 2 1 1 0 0 2 1 2...

output:

93294755255
93291946437
93291905849
93291930160
93291970148
93288955619
93288998449
93289042651
93289002479
93291744929
93294689769
93294650692
93291768144
93294445662
93291579404
93291617784
93294316936
93291496921
93288670156
93285734973
93283089413
93280296518
93277353657
93277315526
93280162676
...

result:

ok 

Test #92:

score: 0
Accepted
time: 475ms
memory: 69588kb

input:

100000
1 2 2 0 1 1 0 0 0 0 0 0 2 2 1 2 0 0 0 0 0 1 2 0 1 0 2 0 0 2 0 1 0 1 0 1 2 2 0 2 1 2 0 2 2 0 0 1 2 1 1 2 1 0 0 1 2 1 0 2 1 0 1 0 0 2 0 2 2 0 1 1 0 1 2 0 0 2 2 0 1 2 0 1 1 2 2 1 2 0 2 1 0 0 0 1 2 2 1 0 1 1 0 2 1 0 0 2 1 1 1 2 0 1 0 1 0 1 2 0 0 2 1 2 1 1 2 0 2 1 1 1 0 0 0 1 2 1 2 2 1 1 1 2 2 2 2...

output:

316136684336
316136626565
316136536103
316127639502
316118013463
316107977992
316107913417
316117391225
316107301123
316097347283
316087783495
316087737078
316078110459
316087866540
316077980382
316087308618
316097274857
316088143581
316097797283
316107750466
316107683345
316117437095
316117370809
3...

result:

ok 

Test #93:

score: 0
Accepted
time: 377ms
memory: 66112kb

input:

100000
0 0 2 0 0 0 0 1 0 1 1 0 2 0 2 2 2 1 2 1 2 0 1 2 1 0 0 1 2 2 0 2 2 0 2 1 2 2 2 1 1 0 1 2 1 1 2 1 2 0 2 1 0 1 2 1 2 1 0 1 0 2 0 1 2 2 1 2 1 2 0 2 1 1 1 1 0 0 0 0 0 0 1 0 0 2 0 0 0 1 1 1 0 2 0 2 1 0 1 1 0 1 1 0 1 2 0 2 0 1 0 0 0 0 1 1 1 1 2 1 2 1 1 2 2 2 1 0 2 1 0 0 0 2 0 1 2 2 1 1 1 0 2 2 1 0 2...

output:

1095656831871
1095619257668
1095618839928
1095588795545
1095554618379
1095554736432
1095589461566
1095589737943
1095624279061
1095623976424
1095624284716
1095598229229
1095568067817
1095567763685
1095568137834
1095568080998
1095602558471
1095568532073
1095534383970
1095567808145
1095567574094
109553...

result:

ok 

Test #94:

score: 0
Accepted
time: 159ms
memory: 67500kb

input:

100000
2 1 0 0 0 2 1 0 1 1 2 1 0 0 1 1 2 2 2 2 1 0 1 2 1 0 0 1 2 1 0 2 2 0 0 0 1 1 1 1 0 2 1 1 2 2 0 1 1 1 0 2 0 1 0 2 1 0 2 1 1 2 2 0 0 0 1 0 1 1 1 1 2 2 1 1 1 0 0 2 0 2 0 1 0 2 1 2 2 0 2 0 0 1 1 0 2 0 1 0 2 2 1 0 0 1 2 0 0 1 0 1 2 2 1 0 1 0 2 1 1 2 2 0 2 0 0 2 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 2 2...

output:

4097865354006
4098331326178
4098516651380
4098050662313
4098049761584
4098050662313
4098516651380
4098050662313
4098516651380
4098050662313
4098516651380
4098050662313
4098516651380
4098049761584
4098050662313
4098142136514
4098141235639
4098608141919
4098142136514
4098238707855
4098237808229
409870...

result:

ok 

Test #95:

score: 0
Accepted
time: 284ms
memory: 66524kb

input:

100000
1 1 2 1 2 1 2 1 1 2 1 1 2 0 0 0 0 2 2 2 0 1 0 0 1 2 0 0 0 1 0 1 1 1 1 2 1 0 1 1 0 0 1 2 1 0 1 0 1 2 0 1 2 1 0 2 2 2 1 1 2 0 2 1 1 0 1 1 1 2 1 0 0 2 2 0 0 0 1 1 2 2 0 2 0 0 0 0 0 0 1 1 0 0 0 1 2 1 1 0 1 0 0 0 2 0 1 0 0 1 2 2 0 0 2 1 2 2 2 0 0 2 1 0 2 2 0 0 1 2 1 2 1 2 2 1 0 2 2 1 0 2 0 0 1 0 1...

output:

4130152291057
4130056852820
4130179707803
4130180563664
4130181455962
4130294178778
4130174597295
4130298144138
4130393454351
4130394596969
4130393850725
4130488422291
4130372094581
4130372982891
4130512333976
4130606032139
4130484424711
4130485171130
4130485895897
4130611887465
4130730104101
413073...

result:

ok 

Test #96:

score: 0
Accepted
time: 177ms
memory: 67052kb

input:

100000
0 2 0 0 1 1 1 2 1 2 1 1 0 2 0 1 2 0 1 0 0 0 0 0 1 0 0 2 1 1 0 0 1 2 0 1 2 0 0 2 0 0 0 1 0 2 0 0 1 1 0 2 1 1 2 2 2 0 1 2 2 0 1 0 2 2 2 2 2 0 2 2 1 2 0 2 0 0 2 1 0 1 1 0 2 2 2 2 0 0 1 0 1 1 1 0 2 1 1 0 2 0 0 0 1 0 2 0 0 2 0 1 2 1 1 1 0 0 0 0 1 0 2 0 1 2 0 1 0 0 1 1 2 0 2 1 2 0 0 0 0 2 0 2 1 0 1...

output:

4100962908565
4100510865543
4100607662611
4100487528621
4100488262981
4100865918189
4100866614488
4100865516353
4100866242610
4100728509312
4101187810873
4101062881775
4100692329824
4101011802771
4100762608651
4100761526715
4100630386031
4100765060727
4101084455940
4101085404592
4100706314594
410058...

result:

ok 

Test #97:

score: 0
Accepted
time: 241ms
memory: 72732kb

input:

100000
1 1 1 1 2 1 2 2 1 1 2 1 2 1 2 2 1 1 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 2 2 1 2 1 1 2 1 2 1 1 1 1 0 1 2 2 1 2 1 1 1 2 1 2 2 1 2 2 1 2 2 1 1 2 1 2 2 2 2 1 1 0 2 1 2 1 2 2 1 2 2 1 1 2 1 1 2 2 2 1 1 1 2 1 2 2 2 2 2 2 1 2 2 1 1 1 1 2 1 1 1 2 2 1 2 2 2 2 1 1 2 1 2 1 2 2 2 1 2 1 2 2 1 1 2 2 1 2 2 1 1 1 2...

output:

760293049692
760306100439
760263999028
760480245694
760492615292
760480829183
760493497722
760535256365
760557814477
760545556296
760586281642
760572056367
760550639584
760536606475
760715883136
760715172930
760727499627
760745780459
760758584604
760778253175
760830109490
760842444211
760860329576
7...

result:

ok 

Test #98:

score: 0
Accepted
time: 198ms
memory: 70032kb

input:

100000
2 0 0 2 2 0 0 0 2 1 0 0 0 2 2 2 2 2 0 2 0 0 0 2 2 2 0 2 2 0 2 0 2 0 0 2 0 0 2 2 2 0 2 1 0 2 2 2 0 0 2 0 2 0 0 0 0 2 0 1 2 0 0 2 2 0 0 0 1 2 0 0 0 0 2 2 0 0 2 2 2 2 0 2 0 2 0 1 2 0 0 2 2 1 2 2 0 0 1 0 2 0 2 2 0 2 2 2 0 0 2 0 1 2 2 2 0 2 0 0 2 0 2 0 0 0 0 2 0 2 2 0 0 2 0 2 0 0 2 2 0 0 2 2 0 2 0...

output:

826654004799
826654194674
826654133463
826654181312
826654023514
826653920266
826653733788
826653945959
826654117797
826653908276
826653782514
826653654511
826653600933
826653703960
826653569046
826653403956
826653364326
826653257770
826653422914
826637448595
826637279229
826637350616
826637456619
8...

result:

ok 

Test #99:

score: 0
Accepted
time: 254ms
memory: 71848kb

input:

100000
0 0 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 2 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 0 0 0 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 2 1 0 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 0 0 2...

output:

805664825072
805710705933
805723700257
805746319258
805945918968
805738618967
805724576457
806002959191
805989799837
805977031104
806165842730
806385976425
806408592276
806377174159
806363910989
806347226901
806360612288
806338305997
806276355069
806502601984
806516973760
806533700682
806519137461
8...

result:

ok 

Test #100:

score: 0
Accepted
time: 143ms
memory: 69872kb

input:

100000
0 1 1 2 1 2 1 0 0 2 0 2 1 1 0 1 0 1 0 2 1 2 0 2 0 2 0 0 1 1 2 1 0 1 1 0 1 0 0 0 2 1 2 1 2 2 0 1 2 0 0 0 0 1 1 2 2 1 1 2 1 2 1 1 0 0 1 1 0 1 2 1 1 1 1 1 1 2 0 2 1 1 0 0 0 0 2 2 1 0 2 2 0 2 1 2 2 0 0 1 1 2 0 0 1 0 2 0 0 2 2 0 0 0 1 0 1 2 2 2 0 1 1 1 0 1 0 1 2 1 2 0 0 1 1 1 2 0 1 0 1 2 0 0 0 2 0...

output:

12378861465034
12378861549997
12379137199914
12378861549997
12378861465034
12379137199914
12378861549997
12379137199914
12378861549997
12379137199914
12378861549997
12378861465034
12379137199914
12378861549997
12378861465034
12379137199914
12379139464690
12378863821511
12378861607010
12378861521021
...

result:

ok 

Test #101:

score: 0
Accepted
time: 164ms
memory: 73680kb

input:

100000
2 1 0 2 1 1 0 2 1 0 1 0 1 2 0 2 0 0 0 1 0 2 2 1 1 1 1 1 1 2 2 1 2 0 2 2 0 2 1 2 1 0 2 2 0 2 2 2 1 2 0 2 1 0 2 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 2 0 0 2 0 2 2 1 1 2 2 1 0 1 1 2 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 2 0 1 0 0 2 0 0 2 0 1 0 2 0 0 1 1 0 2 1 2 0 0 1 0 2 2 0 1 1 0 0 0 0 0 0 2 2 0 2 0 1...

output:

12356317730902
12355757413015
12355206931832
12355757413015
12356309564939
12355759083756
12356309564939
12355757413015
12356309564939
12356317730902
12355757413015
12355764355718
12356316540921
12355759083756
12356316540921
12355764355718
12355757413015
12355206931832
12355764355718
12356324640326
...

result:

ok 

Test #102:

score: 0
Accepted
time: 184ms
memory: 67292kb

input:

100000
0 0 2 0 2 1 0 2 0 0 1 2 1 2 2 2 2 2 0 2 1 1 0 1 0 0 0 2 1 1 0 2 2 2 1 1 2 0 0 1 1 1 0 1 1 1 0 1 2 0 0 0 1 0 0 2 0 0 1 0 2 2 2 0 0 0 1 1 2 0 0 1 0 2 1 2 1 1 2 1 0 0 2 0 0 1 2 1 0 2 0 1 0 0 1 1 0 0 0 1 0 2 2 2 1 0 2 0 0 0 0 2 2 2 1 2 2 0 0 1 1 0 1 1 0 1 1 0 1 2 2 0 2 1 0 1 0 2 2 2 1 1 0 1 1 0 2...

output:

12361639333356
12361912035054
12361609273559
12361770767102
12361412299625
12361269172442
12361537499341
12361367443063
12361634309892
12362109703751
12362114355666
12362375712286
12362234785038
12362428752181
12362669907842
12362625781780
12362630221089
12362634525130
12362620483084
12362319321363
...

result:

ok 

Test #103:

score: 0
Accepted
time: 214ms
memory: 65848kb

input:

100000
2 0 2 2 0 2 1 1 1 2 1 2 1 2 0 1 0 0 1 0 1 1 1 1 2 1 2 0 0 0 2 0 2 0 0 2 1 2 0 0 0 2 2 1 0 2 0 1 1 2 2 1 1 1 2 0 2 0 0 0 1 2 2 1 0 2 2 0 0 1 0 0 1 1 1 1 0 2 0 0 2 1 2 0 1 2 2 1 2 1 0 1 2 0 2 0 2 0 1 2 0 2 0 2 1 0 0 2 0 2 1 0 1 0 1 0 2 0 2 1 1 2 2 0 1 0 1 1 2 2 1 2 1 0 1 1 2 0 1 0 0 2 1 1 1 2 2...

output:

145953829313
146504500096
145953786136
146504500096
145953829313
146504500096
145953786136
146504500096
146498364765
146494865483
145944184844
145944228277
145940137065
146490757708
146487565932
145936961863
145866474549
145866437173
145862282860
146412887959
145862282860
146412887959
145862239383
1...

result:

ok 

Test #104:

score: 0
Accepted
time: 366ms
memory: 65876kb

input:

100000
2 2 0 0 2 1 0 1 1 0 0 2 0 1 1 0 2 1 1 1 0 2 1 2 1 1 1 0 0 2 1 0 0 1 1 0 1 0 1 0 0 0 2 2 2 1 0 0 2 1 2 1 0 2 2 2 1 2 1 0 1 2 2 1 2 2 0 2 0 1 2 1 0 2 1 2 0 1 0 2 2 2 2 0 0 1 1 0 2 1 1 0 1 2 1 1 2 0 2 2 1 0 1 1 2 0 0 2 0 1 0 1 0 0 0 0 2 2 1 0 0 0 1 1 1 0 0 2 1 2 1 0 1 0 0 1 0 2 0 1 2 0 1 2 2 1 2...

output:

151045518233
151048940412
151048989721
151053526119
151050138354
151050193203
151055666168
151055685648
151051538661
151051501359
151051437434
151055614564
151055562909
151050782917
151045903094
151045858691
151045902613
151050281551
151054706281
151054659497
151051011982
151051038544
151050997994
1...

result:

ok 

Test #105:

score: 0
Accepted
time: 315ms
memory: 64848kb

input:

100000
2 1 1 2 1 2 1 1 2 2 1 2 2 2 2 1 2 2 2 1 2 2 1 1 2 2 1 2 2 2 2 1 2 1 2 2 1 2 2 2 2 2 1 1 0 2 1 2 2 1 1 2 1 2 2 1 2 2 1 1 1 2 1 2 2 1 1 0 1 1 1 2 2 2 1 1 2 1 2 2 1 1 2 0 1 1 2 1 2 2 2 1 2 1 1 1 1 2 1 1 1 1 1 1 2 1 2 1 1 0 1 2 2 2 2 1 2 2 1 1 2 1 2 1 1 1 2 1 1 1 2 1 2 2 2 2 1 2 2 2 1 1 2 1 2 1 1...

output:

32424642834
32424016637
32423181413
32422521607
32422011030
32421420718
32421975315
32422021723
32421445691
32422124570
32421644969
32437042481
32437981275
32437188280
32437694289
32437234630
32436460553
32435914229
32435762179
32436340401
32437235210
32436735319
32436674155
32436085921
32435406450
...

result:

ok 

Test #106:

score: 0
Accepted
time: 319ms
memory: 69744kb

input:

100000
2 2 0 2 2 0 0 0 2 2 0 2 2 0 2 2 0 2 0 2 2 0 0 0 2 0 0 2 0 2 2 0 2 0 0 0 0 0 0 0 2 0 2 2 2 2 2 2 0 2 0 0 2 2 0 0 2 2 0 2 0 0 0 2 2 0 0 2 0 2 0 2 2 0 2 0 2 0 2 2 2 0 0 2 2 0 2 0 0 0 2 0 0 0 0 0 2 2 2 2 2 0 0 2 2 2 0 2 2 0 0 2 0 2 2 1 2 0 0 2 2 2 2 2 0 0 2 0 0 0 2 0 2 0 2 0 0 0 2 1 2 2 0 0 0 2 0...

output:

30359891732
30359464977
30359456207
30359468177
30359458176
30359469622
30359249191
30359234680
30359226951
30359218756
30297949108
30297963056
30297968904
30297347234
30297356949
30297345763
30297355160
30297345296
30297358418
30297351515
30297358970
30297347945
30297338878
30297327219
30297318098
...

result:

ok 

Test #107:

score: 0
Accepted
time: 336ms
memory: 68416kb

input:

100000
0 0 1 0 0 1 1 1 0 0 1 1 1 1 0 2 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 0 0 1 0 1 2 0 0 0 1 1 1 0 1 1 1 1 0 1 0 2 0 1 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1 1 1 0 2 1...

output:

30136609798
30136083207
30136736964
30135867822
30136355770
30136818513
30137497353
30137018626
30137619738
30138121767
30138581832
30138076345
30147341758
30147950560
30147393815
30147136333
30157889347
30161770164
30162347130
30161851147
30154669620
30163331241
30162783461
30162151016
30161255000
...

result:

ok 

Test #108:

score: 0
Accepted
time: 330ms
memory: 65744kb

input:

100000
2 0 1 2 1 0 0 1 1 2 2 0 0 0 2 1 1 0 1 1 0 1 1 0 0 0 0 0 1 1 2 2 2 2 1 2 0 2 2 1 2 1 2 0 0 2 2 0 1 0 0 1 0 1 1 0 2 1 2 2 0 1 1 1 2 1 2 2 1 2 1 0 2 2 2 1 0 1 2 0 1 1 0 0 1 0 1 2 0 0 2 1 2 0 1 0 0 1 0 0 0 0 1 0 2 1 1 2 2 2 2 2 2 0 0 0 1 2 0 2 0 0 0 0 0 0 0 0 2 2 1 1 0 1 1 1 2 1 1 1 1 1 2 0 2 2 1...

output:

135628486664
135625574730
135621919068
135617830047
135622386052
135623351927
135623329877
135618955253
135614745390
135618471579
135622037033
135625519834
135625536177
135621562312
135617599779
135621889275
135621856312
135626209041
135629696172
135632966938
135629614690
135633710238
135637450477
1...

result:

ok 

Test #109:

score: 0
Accepted
time: 146ms
memory: 60348kb

input:

100000
2 1 0 2 1 2 2 2 0 1 2 1 1 2 1 2 1 1 1 1 1 0 1 0 0 1 0 1 1 2 0 1 2 1 0 1 2 2 2 1 0 1 0 2 1 1 2 0 1 0 0 2 0 2 2 2 2 1 0 2 0 1 1 2 2 2 0 2 1 0 1 1 0 1 1 0 1 1 1 2 2 0 2 1 1 2 0 0 0 2 0 2 2 1 1 2 2 1 2 2 1 0 2 0 1 2 2 1 1 1 2 2 1 1 1 2 0 0 0 0 1 0 0 0 2 0 2 0 0 2 1 0 0 2 2 2 0 1 1 1 1 1 0 1 0 0 1...

output:

1107046824
0
0
1107046824
0
1107046824
0
1107046824
0
1107046824
0
1107046824
1107013440
1107046824
0
0
1107079985
0
0
1107080208
0
1107080208
0
1107080208
0
0
0
0
0
1107080429
0
0
1107080429
0
0
0
0
0
0
0
1107113592
0
0
0
0
0
0
0
0
0
1107113370
0
0
0
1107113370
1107146532
0
1107146532
0
1107146532
...

result:

ok 

Test #110:

score: 0
Accepted
time: 162ms
memory: 57128kb

input:

100000
2 2 2 1 2 0 2 2 0 1 0 1 0 2 0 0 0 1 0 0 1 1 1 2 0 2 2 0 1 0 2 2 1 0 0 0 2 1 2 1 0 0 2 0 2 2 2 0 2 2 2 0 0 0 1 1 2 0 2 0 2 2 1 1 0 0 0 0 0 1 0 0 0 0 2 2 0 0 2 1 0 0 2 0 2 1 1 1 2 1 0 0 2 0 1 1 2 1 0 1 2 1 2 2 0 2 0 0 2 0 0 2 0 1 2 0 2 2 1 0 2 2 0 0 2 0 0 1 2 1 1 0 0 1 2 1 2 2 1 1 1 2 1 0 2 0 0...

output:

1110249440
1110282960
1110249837
1110283356
1110250232
1110249837
1110250232
1110217108
1110217500
1110251016
1110217500
1110251016
1110251405
1110251792
1110284920
1110251405
1110217890
1110251016
1110284532
1110318048
1110351176
1110384304
1110383913
1110417432
1110383913
1110384304
1110351176
111...

result:

ok 

Test #111:

score: 0
Accepted
time: 155ms
memory: 57960kb

input:

100000
1 1 1 1 2 1 2 2 2 2 2 2 2 2 2 2 2 1 1 1 2 1 2 1 2 1 1 2 1 1 2 1 2 1 2 2 2 2 2 2 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 2 1 2 2 2 2 2 2 1 1 2 2 1 1 1 2 2 2 1 1 2 2 1 2 1 2 2 2 2 1 1 1 1 2 1 0 2 1 2 2 1 2 2 1 2 1 1 1 1 2 2 0 2 2 1 2 0 1 2 1 1 2 2 2 2 1 2 1 1 1 2 1 2 2 2 1 2 1 2 2 0 2 1 1 2 1 1 2 1 1 2 1...

output:

146452258
146455281
146452258
146455281
146458304
146503728
146500704
146497680
146500704
146503728
146500704
146497680
146494656
146497680
146543100
146546125
146549150
146552175
146549150
146552175
146549150
146546125
146543100
146540075
146585492
146588518
146591544
146588518
146585492
146582466
...

result:

ok 

Test #112:

score: 0
Accepted
time: 165ms
memory: 60492kb

input:

100000
2 0 0 2 2 1 0 0 2 2 2 2 2 2 0 0 2 2 2 0 2 0 2 0 0 2 0 0 0 0 2 0 0 0 2 0 1 0 1 0 2 0 0 0 0 2 2 2 0 2 2 2 0 0 0 0 2 2 0 2 1 2 2 0 2 2 0 2 2 0 0 0 2 0 0 2 0 0 2 2 2 2 0 1 2 0 2 2 0 0 0 2 0 0 2 0 0 1 2 2 0 0 0 0 2 0 0 2 2 0 0 0 2 2 0 0 2 2 2 0 0 1 2 2 2 0 0 0 2 2 0 2 2 2 2 0 2 0 0 2 2 2 2 0 0 0 2...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 

Test #113:

score: 0
Accepted
time: 164ms
memory: 60148kb

input:

100000
1 0 0 1 0 2 1 2 1 1 1 1 1 0 0 0 0 1 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 1 1 0 0 2 1 0 1 0 0 0 1 2 0 1 0 1 1 1 0 1 0 1 2 0 1 2 1 1 1 0 2 0 1 1 0 0 2 1 1 2 0 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 1 1 1 2 0 0 0 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 1...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 

Subtask #7:

score: 14
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #114:

score: 14
Accepted
time: 314ms
memory: 119596kb

input:

200000
2 1 1 1 2 0 2 2 2 0 1 1 0 1 2 1 1 2 1 2 2 2 1 0 0 0 0 2 1 0 2 0 1 1 2 1 0 2 0 2 1 2 1 1 0 1 0 2 0 0 1 2 0 0 0 0 0 2 1 2 0 0 1 1 0 1 2 1 0 0 0 1 1 2 1 0 1 1 1 1 2 0 1 1 1 2 2 0 0 1 0 1 0 2 2 2 2 2 0 1 0 2 2 1 2 1 2 0 0 0 0 1 1 2 1 1 2 1 0 0 2 2 0 2 1 2 1 1 2 2 2 0 1 1 2 2 0 1 1 0 1 2 1 0 2 0 1...

output:

76960503493028
76962705274605
76960496001543
76962705274605
76960503493028
76960511516477
76960504028860
76962713300463
76960511516477
76962713300463
76960504028860
76962713300463
76960511516477
76960504028860
76962713300463
76960504028860
76962713300463
76963427687246
76961218470400
76960703082954
...

result:

ok 

Test #115:

score: 0
Accepted
time: 366ms
memory: 123036kb

input:

200000
1 1 1 1 2 0 2 1 0 0 2 2 0 0 0 1 1 1 1 0 2 2 1 1 1 2 0 2 1 0 2 0 1 2 0 2 1 1 1 0 2 0 2 1 0 0 0 2 2 1 2 1 1 0 2 1 0 2 2 0 0 1 1 2 2 1 2 0 1 2 2 1 1 1 0 0 1 1 0 0 0 2 2 0 1 1 0 2 2 0 1 0 2 0 0 2 1 2 0 2 1 0 1 0 0 1 1 0 0 2 2 2 2 1 1 0 2 2 1 0 0 0 2 2 0 0 2 1 1 1 0 1 1 2 2 0 2 2 1 1 2 1 2 0 1 1 2...

output:

76935543540291
76935537488010
76937256041318
76937262138072
76937274387699
76935541886938
76933794932586
76935529592622
76935545772484
76935529592622
76935545772484
76937278273461
76937290433696
76935543524040
76937290433696
76935557977408
76937284515266
76935537560921
76937272265653
76935537488010
...

result:

ok 

Test #116:

score: 0
Accepted
time: 381ms
memory: 118956kb

input:

200000
1 0 0 0 0 1 2 2 2 0 0 2 0 1 2 0 2 1 1 0 2 1 1 0 2 2 2 1 1 0 1 0 0 2 1 0 0 1 1 2 0 0 0 1 0 2 0 2 2 1 2 1 1 0 0 1 0 0 1 1 2 2 0 1 1 2 0 2 1 0 1 0 2 2 0 1 2 0 2 2 1 2 2 2 0 1 0 2 1 1 2 0 0 1 2 0 2 0 1 0 0 0 2 2 1 0 2 1 2 0 1 2 2 2 1 0 1 1 0 2 1 1 1 0 2 0 0 0 1 1 0 1 2 0 1 1 0 1 1 0 2 0 0 0 0 2 2...

output:

77098179826945
77097160475230
77097151877158
77097142355872
77098127115484
77098115558257
77098508770418
77099479219660
77099491053627
77098924728500
77099711897758
77101370265870
77102509282174
77103297568310
77104480783722
77104488324219
77102768957907
77102754445530
77102761343163
77102768744472
...

result:

ok 

Test #117:

score: 0
Accepted
time: 467ms
memory: 119308kb

input:

200000
1 1 2 1 1 2 2 2 2 2 1 1 2 1 2 2 2 1 1 2 2 1 2 2 1 2 1 2 1 1 1 2 2 2 2 1 1 1 2 2 1 2 2 1 2 2 1 1 1 2 2 1 1 2 1 2 1 2 2 1 2 2 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 1 2 1 2 2 1 1 2 2 2 1 1 2 1 2 2 1 2 2 2 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 1 1 1 1 1 1 2 1 2 2 1 1 1 2 1 1 1 1 2 1 2 2 1 2 1 1 2 1 2 1 1 1 2...

output:

14641427280749
14641381836999
14641591194363
14641497543753
14641483362104
14641511155079
14641570388439
14641510022907
14641350809134
14641210882912
14641155811205
14643929442862
14644148944958
14644268218401
14644220823868
14644266390275
14644223861826
14644232816038
14642107484961
14642092116823
...

result:

ok 

Test #118:

score: 0
Accepted
time: 327ms
memory: 124116kb

input:

200000
0 2 0 2 2 0 0 0 2 2 0 0 2 0 0 0 0 2 0 2 2 2 0 0 0 2 0 0 0 0 2 2 0 1 0 0 0 2 2 2 0 2 2 2 2 0 0 0 2 0 2 2 0 0 2 2 2 2 0 2 0 2 0 2 0 0 2 2 2 0 2 2 0 2 0 0 2 0 0 2 0 2 1 2 0 0 0 2 0 2 2 0 2 0 2 2 0 2 0 2 2 2 2 2 0 2 2 2 0 2 2 0 2 0 2 0 2 2 2 0 0 0 2 2 0 0 2 0 2 0 2 0 0 2 0 0 0 0 0 0 2 1 0 0 2 2 0...

output:

14700180435236
14700180643702
14700180000483
14700180844643
14700180138824
14700180353122
14700179821102
14700179832877
14700178598299
14700177727619
14700178915175
14700179720688
14700178075835
14700178136197
14700178983787
14700179028034
14700178184835
14700177882127
14700179568142
14700181326427
...

result:

ok 

Test #119:

score: 0
Accepted
time: 417ms
memory: 123720kb

input:

200000
0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 2 1 0 0 1 0 1 1 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 0 1 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 2 0 0 0 0 1 0 0 1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 0 1 1 1 1 2 0 0 1 1 0 0 0 1...

output:

14924660353509
14924566776626
14924654123509
14924795231646
14924821348923
14924999108640
14924918976036
14924893049886
14925117321841
14925198818548
14925357392128
14926979829931
14926819101467
14926790950577
14928237544802
14928378120477
14928589989774
14928572888644
14928722898772
14928953023286
...

result:

ok 

Test #120:

score: 0
Accepted
time: 1033ms
memory: 118736kb

input:

200000
1 2 2 1 1 0 2 1 0 2 0 1 0 0 0 1 2 2 1 0 0 2 1 1 2 2 1 2 1 1 0 1 1 0 2 2 1 0 1 0 2 2 0 0 0 2 0 2 2 0 0 1 0 0 0 1 2 2 2 1 1 1 1 2 1 0 0 1 1 2 0 1 2 1 1 1 1 2 1 0 0 2 2 2 2 2 2 0 2 1 2 1 0 0 2 1 2 0 1 1 0 0 2 1 0 1 2 2 2 1 0 0 0 2 2 2 2 2 1 2 1 2 0 2 1 2 2 1 1 1 1 1 2 2 1 0 0 0 0 0 1 0 0 1 0 2 2...

output:

475484584596
475477023035
475484152062
475477055700
475477064773
475469956435
475469950212
475469944726
475469946682
475469944613
475463342423
475470435286
475470428290
475477547103
475484518072
475484507411
475476998094
475469930344
475477285725
475477278377
475477277338
475470645678
475464063517
4...

result:

ok 

Test #121:

score: 0
Accepted
time: 1022ms
memory: 118668kb

input:

200000
2 2 0 1 2 1 2 1 2 1 0 0 0 0 2 0 2 0 0 1 2 2 0 0 1 2 2 0 2 1 2 1 1 0 1 0 1 0 2 1 2 0 2 0 1 1 0 1 1 0 0 2 1 0 2 0 2 2 0 2 2 0 1 2 0 0 0 1 1 0 0 0 1 0 2 2 0 0 2 2 2 2 0 2 2 2 1 2 1 0 2 1 1 0 1 1 0 0 1 1 1 2 1 0 0 0 0 1 1 2 2 0 1 2 1 1 2 1 0 1 1 1 2 1 1 2 2 1 0 1 1 1 2 0 2 2 1 1 0 2 1 1 0 0 1 0 0...

output:

483752269187
483759412576
483759372233
483752770435
483752727101
483760392949
483753119179
483750025195
483757150690
483757125759
483764561983
483764620879
483764597001
483764642347
483756751826
483730608430
483737884777
483737917906
483745468160
483738384762
483731187340
483738262838
483741885665
4...

result:

ok 

Test #122:

score: 0
Accepted
time: 1062ms
memory: 118216kb

input:

200000
1 1 0 0 0 0 2 1 2 1 0 0 2 0 0 1 0 2 2 1 1 2 1 2 2 2 1 0 1 0 2 1 0 2 2 2 0 2 0 2 1 1 2 0 0 0 2 0 2 0 0 2 0 1 0 0 2 1 0 1 2 0 1 2 0 2 2 0 2 2 2 1 0 2 2 2 1 2 2 0 1 2 0 1 2 2 0 2 2 1 2 1 1 1 0 0 0 1 0 1 0 0 1 0 1 2 0 0 2 2 2 2 0 0 2 2 0 0 0 2 2 0 1 2 0 0 0 0 1 2 1 2 2 1 1 2 1 1 0 0 2 0 0 1 0 0 1...

output:

151195588571
151193220427
151193242852
151193266818
151195675677
151197969505
151197941777
151194956515
151192627987
151192605596
151192629191
151190229704
151190204860
151187695035
151189900095
151189922570
151192017323
151189626992
151189652752
151191947672
151191967387
151194391353
151196815811
1...

result:

ok 

Test #123:

score: 0
Accepted
time: 1093ms
memory: 118104kb

input:

200000
1 2 1 1 2 1 1 2 1 1 2 2 0 0 1 2 2 1 2 1 0 1 1 2 0 0 2 0 0 2 2 2 0 1 0 2 1 2 2 2 2 2 0 1 0 0 1 0 1 0 0 0 1 2 1 1 1 0 2 1 2 0 1 0 0 0 1 2 1 2 0 1 0 0 1 0 1 0 0 1 2 0 0 0 2 0 2 1 1 0 1 1 2 1 1 1 2 1 2 2 1 0 1 1 2 2 1 2 2 2 2 1 0 2 2 2 2 1 2 2 0 1 0 1 1 1 0 2 1 1 1 1 2 2 2 2 0 0 2 1 2 1 0 1 1 0 0...

output:

483990607797
483998378402
484005066886
483997203628
484004533018
483996631819
484004114303
483997249167
484004324512
484011018768
484011048584
484003707843
484011529570
484011464542
484004077993
483996521147
484003803615
483996564665
484003699483
484010846359
484017982434
484017949359
484017894854
4...

result:

ok 

Test #124:

score: 0
Accepted
time: 1039ms
memory: 117516kb

input:

200000
2 1 2 1 0 0 0 0 1 1 2 0 1 2 2 2 1 0 1 0 0 2 1 1 2 0 2 0 2 0 0 2 2 0 0 1 1 1 2 0 1 0 1 0 2 1 2 1 0 2 1 0 0 0 0 2 0 1 1 1 1 1 0 1 0 1 0 2 2 1 0 0 0 1 1 2 1 2 0 1 2 1 2 2 0 1 2 1 0 2 1 0 2 2 2 1 2 2 0 1 0 2 0 0 0 1 2 2 1 1 2 1 2 0 1 0 1 0 0 1 1 0 1 1 1 1 2 1 0 0 2 2 2 1 0 0 0 2 2 1 2 0 2 1 2 2 1...

output:

1855157714467
1855157556001
1855186505256
1855186433443
1855186378136
1855158410185
1855130735045
1855102597120
1855131442379
1855104228054
1855104073106
1855075991912
1855048242160
1855048074919
1855021208489
1855021282766
1855049162540
1855077628841
1855049208103
1855077401554
1855048901866
185507...

result:

ok 

Test #125:

score: 0
Accepted
time: 765ms
memory: 118008kb

input:

200000
0 1 1 1 1 2 2 0 0 2 1 1 2 1 2 2 1 0 1 2 1 1 1 2 2 1 1 1 2 2 1 0 0 2 2 1 2 0 0 2 0 2 1 2 1 1 2 1 1 2 1 1 2 0 0 0 1 1 2 0 0 2 0 2 2 2 2 0 2 0 1 2 1 2 2 0 2 2 0 1 2 0 1 2 1 1 1 1 1 1 2 2 1 0 2 1 2 1 1 0 0 1 2 1 1 2 1 2 2 2 2 1 1 2 0 1 2 2 2 0 2 1 2 2 2 1 0 0 0 0 1 1 1 2 2 2 0 1 2 1 2 1 2 2 1 0 2...

output:

7307529485570
7307529387202
7307643601427
7307643512474
7307643546517
7307535088962
7307634019184
7307748365449
7307861196229
7307783763173
7307673896781
7307673696550
7307562634559
7307445332859
7307539952845
7307426352138
7307425720589
7307425419432
7307424758921
7307312800339
7307313472183
730742...

result:

ok 

Test #126:

score: 0
Accepted
time: 388ms
memory: 122676kb

input:

200000
2 2 2 0 2 0 1 1 1 1 2 0 2 1 0 1 1 0 1 2 1 2 0 0 0 0 2 0 0 2 1 1 0 0 2 1 0 1 1 0 2 0 1 0 1 0 0 0 2 2 0 1 2 1 0 1 0 2 1 1 0 0 1 1 1 2 0 2 0 1 2 2 1 1 1 2 2 1 1 1 0 1 2 1 2 2 0 1 0 2 1 1 0 0 1 0 1 2 1 2 0 2 2 2 1 2 1 2 0 1 1 0 1 2 0 1 1 1 2 0 1 2 0 0 0 2 1 1 2 1 0 1 1 1 1 1 0 2 2 1 2 1 0 0 0 1 0...

output:

32999729069605
32997873228996
32999729069605
32997873228996
32997872862301
32997873228996
32999729069605
32997872862301
32999729069605
32999351222414
32997495048244
32997877487923
32999733693422
32999733411079
32997877567839
32997877207064
32997875079250
32998248153718
32999700464342
33001556640080
...

result:

ok 

Test #127:

score: 0
Accepted
time: 472ms
memory: 122064kb

input:

200000
0 2 0 0 2 1 0 1 0 1 1 1 2 2 2 1 2 2 0 0 1 2 1 2 2 2 1 0 2 1 1 2 2 0 1 1 0 2 0 2 1 2 1 0 2 1 1 0 1 0 0 1 1 0 1 0 0 1 2 0 2 0 2 0 2 2 2 0 0 0 2 0 0 1 0 2 1 1 0 0 1 1 0 0 1 1 1 2 2 1 0 0 2 1 0 0 2 1 1 1 2 1 2 2 1 2 1 0 1 0 1 0 2 0 1 2 2 2 1 0 1 2 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 0 0 0 1 1 2 1 1 1 1...

output:

32861456325372
32861013861538
32861615827163
32862149896541
32862535190798
32862164623372
32861769688595
32861114575110
32861111848014
32861109085196
32861106482925
32861101223443
32861471828796
32861469137504
32861852542189
32862540252483
32862158195377
32861713476328
32861294944212
32861297732044
...

result:

ok 

Test #128:

score: 0
Accepted
time: 504ms
memory: 122372kb

input:

200000
2 0 1 2 0 2 2 0 1 1 1 0 0 2 1 0 2 2 2 0 0 0 2 0 0 0 2 1 0 1 2 2 1 1 0 2 0 2 2 2 2 0 0 0 2 2 1 1 2 0 2 0 1 1 0 1 0 1 2 0 2 0 2 2 2 1 2 1 2 2 0 1 2 2 1 2 1 0 2 0 2 1 1 2 2 0 2 2 0 1 0 0 0 2 0 1 2 2 1 0 2 2 2 1 2 2 0 1 0 2 1 0 0 2 2 2 1 2 2 1 1 0 2 0 0 2 2 2 2 2 1 1 1 0 2 0 1 0 0 1 2 1 1 1 2 0 0...

output:

33282420852268
33283159665836
33283637866161
33284195744293
33284193351552
33284641127689
33284632318217
33282817225949
33283330736392
33283332955226
33283779695198
33283355802839
33282186725096
33281785175692
33282226169151
33281686059885
33282247421869
33280860113599
33280863513544
33281212461397
...

result:

ok 

Test #129:

score: 0
Accepted
time: 492ms
memory: 121212kb

input:

200000
2 2 1 2 1 2 1 1 2 1 1 2 2 2 2 2 1 2 2 2 2 2 1 2 2 1 1 2 1 1 2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2 2 2 1 2 1 2 1 1 2 2 1 1 1 1 2 2 1 1 2 1 2 1 1 1 2 1 1 1 1 2 1 1 2 1 2 2 2 1 2 2 1 2 1 0 2 2 1 2 1 1 1 1 1 1 2 1 2 2 1 1 2 1 2 1 1 2 2 2 1 2 1 1 2 2 1 1 1 1 2 1 1 1 1 2 1 1 1 1 2 0 2 1 2 2 1 2 1 1 2 1 2...

output:

6322259063738
6322187486140
6322251539650
6322496078910
6322589973501
6322516448156
6322610352853
6322676031183
6322725777685
6322774613538
6322688771775
6322852085951
6322920509175
6322961072535
6322907640838
6324061815029
6323969073256
6324066029043
6324120345403
6324206759828
6323971946180
632403...

result:

ok 

Test #130:

score: 0
Accepted
time: 394ms
memory: 123368kb

input:

200000
0 2 2 0 0 0 0 0 2 2 0 0 2 0 0 0 2 0 2 2 0 2 1 2 0 0 0 0 0 2 2 2 2 2 0 0 0 0 2 0 2 2 0 2 0 0 0 2 0 2 0 0 2 0 2 2 0 0 2 0 2 0 2 2 2 2 0 0 0 2 2 2 0 0 2 2 0 0 0 2 2 2 2 0 0 0 0 2 0 0 0 0 2 2 0 2 2 0 0 1 0 2 2 2 2 2 0 2 0 2 0 2 0 0 0 2 0 0 0 2 1 1 0 0 0 2 2 2 0 0 2 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1...

output:

6522993991132
6522994060596
6522994124631
6522994180414
6522994201015
6522994150693
6522993936177
6522993909176
6522993997076
6522993957295
6522994031775
6522993971974
6522993743632
6522900660980
6522900626512
6522900559849
6522900473095
6522900530729
6522900511060
6522900425916
6522900471179
652290...

result:

ok 

Test #131:

score: 0
Accepted
time: 526ms
memory: 123412kb

input:

200000
0 1 1 1 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 2 0 1 1 1 0 1 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 0 0 1 0 0 1 0 0 2 1 1 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 1 1 0 1 2 0 0 1 0 1 0 0 0 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 1 1 2 1 1 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 1 1 0 0 1 1 0 0 0 0 0 1 0 0 0 0...

output:

6276993767048
6276925801827
6276976272394
6276923695700
6276972153298
6278076897664
6278142305903
6278221454177
6278168039783
6278216526363
6278460692025
6278536149264
6278776916695
6278726666525
6278681616016
6278629405493
6278483344231
6278353766319
6278268111665
6278116224342
6278197637027
627812...

result:

ok 

Test #132:

score: 0
Accepted
time: 325ms
memory: 120856kb

input:

200000
0 0 2 1 1 2 2 1 0 0 1 2 2 0 1 1 0 1 1 0 1 2 1 2 2 2 2 0 2 0 2 0 0 2 0 1 1 1 0 2 1 2 2 1 2 0 1 0 1 2 2 2 0 2 1 1 1 1 0 0 0 2 1 1 2 2 0 2 2 0 1 0 0 2 2 1 2 2 1 0 2 1 2 0 0 2 1 1 1 0 0 0 2 2 0 1 1 0 0 1 0 2 2 2 2 1 0 0 1 0 2 0 2 0 0 1 0 2 1 1 1 1 2 0 1 0 2 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 2 1 1...

output:

98591152363406
98591158840501
98592257209933
98592998106969
98591899793346
98591552522091
98592650791046
98591638788396
98590534049112
98591071047322
98591077517259
98591071047322
98592175734025
98591071047322
98591077517259
98591071047322
98591077517259
98591071047322
98591077517259
98590375103441
...

result:

ok 

Test #133:

score: 0
Accepted
time: 351ms
memory: 126808kb

input:

200000
1 2 0 0 1 1 1 1 0 0 0 2 1 1 2 2 1 0 1 2 1 0 1 1 2 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 2 0 2 2 1 0 0 0 2 1 1 1 2 1 1 0 0 0 0 1 1 1 0 2 1 2 1 0 1 1 2 0 1 1 2 1 1 1 2 1 1 1 0 2 0 0 2 1 1 0 2 2 1 2 1 2 1 1 1 1 0 1 2 1 2 1 2 2 0 0 0 2 2 0 2 1 0 0 2 0 1 0 1 0 2 1 1 1 1 2 2 1 1 0 0 1 0 0 0 1 1 0 1 1 0 1 2...

output:

98537318743601
98535093891840
98537318743601
98537308851883
98539521246522
98537306220079
98537312658997
98539537577158
98539527619040
98537312658997
98539537577158
98537318743601
98537308851883
98537318743601
98537308851883
98539521246522
98537306220079
98539521246522
98539527619040
98539537577158
...

result:

ok 

Test #134:

score: 0
Accepted
time: 469ms
memory: 131492kb

input:

200000
2 2 0 2 1 1 0 0 1 2 1 1 2 1 0 2 1 0 2 1 1 0 1 1 1 1 0 1 1 0 2 0 1 0 2 0 2 2 1 1 1 1 2 0 0 1 1 1 1 1 0 2 2 2 2 1 1 2 1 0 1 1 0 0 2 0 2 2 0 2 0 2 0 1 1 1 2 1 1 2 2 1 0 2 1 0 2 1 0 0 2 0 0 2 2 0 0 0 0 2 2 2 2 2 0 1 1 2 1 0 1 1 2 0 2 1 0 1 1 2 0 0 2 2 0 2 0 0 1 1 0 2 1 0 1 0 1 2 2 2 2 0 1 0 2 0 2...

output:

98949912785464
98949866297414
98949873005319
98949869791396
98950641034160
98949567782126
98950561050083
98951997956523
98950883849696
98951931710610
98952098745662
98952103171320
98951034169978
98951026849914
98950321784690
98950313905247
98950943350186
98948950244151
98949332741811
98949871266016
...

result:

ok 

Test #135:

score: 0
Accepted
time: 484ms
memory: 117104kb

input:

200000
2 0 0 1 0 2 2 0 0 1 0 0 0 1 2 2 1 0 0 0 0 2 2 0 2 2 1 0 0 2 0 1 1 0 1 2 1 0 0 0 0 2 2 1 0 0 0 0 1 1 0 1 2 1 2 0 0 0 0 0 1 1 2 1 1 2 2 2 0 2 0 0 1 0 1 1 0 2 0 2 2 2 0 0 0 0 1 0 2 0 1 0 1 2 2 0 2 2 0 2 1 2 0 0 0 0 2 0 1 2 0 1 1 2 1 0 2 2 0 2 1 0 1 0 0 2 2 0 2 0 1 1 2 1 1 2 2 0 1 1 2 2 1 2 1 0 1...

output:

694221705821
697096843216
697109844365
697109709618
694234611111
697109709618
694234611111
697109709618
694234532147
697109709618
694234532147
694226657855
694226736766
694226870247
694218569824
694207709836
697082687383
694207631108
694197098627
697072113995
694197177267
694204360137
694204281517
6...

result:

ok 

Test #136:

score: 0
Accepted
time: 829ms
memory: 119016kb

input:

200000
0 2 1 2 2 0 0 2 1 2 0 0 2 2 1 1 1 0 0 1 1 0 2 1 2 2 2 1 1 0 1 0 2 0 2 1 0 0 1 1 2 1 1 0 0 2 2 0 0 0 1 2 2 0 1 1 2 1 0 0 2 1 0 1 1 1 0 0 2 1 1 0 1 2 1 2 1 2 1 1 2 0 1 2 1 2 1 2 1 1 0 2 1 1 0 0 0 1 2 2 1 1 1 2 1 1 2 2 0 1 0 1 0 0 1 0 1 2 0 0 1 2 0 0 2 2 2 0 0 0 0 0 1 2 1 2 1 1 1 2 1 2 1 1 2 2 2...

output:

774783460710
774796156681
774786005675
774770452662
774784963274
774784885329
774772673424
774787097419
774787055580
774800669037
774787334633
774787262298
774787111280
774777535385
774777458561
774767544911
774767633506
774754818327
774766432805
774777926427
774764661997
774776413138
774776453471
7...

result:

ok 

Test #137:

score: 0
Accepted
time: 773ms
memory: 118260kb

input:

200000
2 1 1 2 2 2 1 2 2 2 1 1 2 2 2 1 1 1 2 1 2 2 2 1 2 1 1 1 0 2 2 1 1 1 1 2 1 2 2 2 2 2 2 1 2 1 2 2 2 1 1 1 2 1 1 2 2 1 2 1 2 1 2 2 1 1 1 1 2 1 2 2 2 1 1 2 1 1 1 2 1 2 2 1 1 2 1 1 1 2 1 1 2 0 2 1 1 0 2 2 1 2 1 1 1 1 1 2 2 2 0 2 2 2 2 2 1 1 1 0 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 1 2 1 2 1 1 1 1 2 1 1 2...

output:

172284391184
172282557032
172312660973
172347151659
172348877742
172379542459
172380938008
172382416414
172383824648
172382557220
172384430967
172386459027
172387864596
172389232793
172391435358
172393128113
172391545802
172389453203
172387651689
172415558212
172414019001
172415383475
172413425280
1...

result:

ok 

Test #138:

score: 0
Accepted
time: 722ms
memory: 118092kb

input:

200000
2 2 2 0 2 2 0 2 0 2 2 0 0 0 2 0 0 2 2 0 0 2 2 2 0 2 2 0 0 2 2 0 2 2 2 0 0 0 0 2 2 0 2 0 0 2 0 2 0 2 0 2 2 1 0 2 2 0 0 2 2 0 2 2 0 1 2 2 2 0 2 2 0 1 0 2 2 2 2 2 0 0 0 0 2 2 0 0 0 2 0 0 2 0 2 2 2 1 0 0 2 2 1 0 2 2 0 0 2 2 2 2 2 0 0 2 0 0 0 2 0 0 0 2 0 0 2 2 2 2 2 2 2 2 2 2 0 2 2 0 2 2 0 2 2 0 2...

output:

143694198034
143694181771
143692828575
143692824890
143692821843
143691067445
143691074047
143691077533
143691067383
143691071139
143691074199
143691086559
143691095272
143691091712
143691082951
143691079259
143689969506
143691398854
143691403231
143691409524
143691397375
143689780198
143689791946
1...

result:

ok 

Test #139:

score: 0
Accepted
time: 749ms
memory: 119188kb

input:

200000
1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 2 2 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 0 0 1 0 1 1 1 1 1 0 1 1 1 0 2 1 1 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 0 0 1 1 0 1 0 1 1 0 1 1 1 0 1 0 2 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 0...

output:

150925283170
150926850691
150927945877
150926828879
150925413496
150924114556
150926147195
150928060454
150929785988
150931963492
150913974116
150915933915
150936958390
150956211943
150958072739
150956511900
150983388856
150984437489
151006289631
151007884536
151009242131
151007631535
151007248035
1...

result:

ok 

Test #140:

score: 0
Accepted
time: 661ms
memory: 117552kb

input:

200000
2 2 0 1 2 0 1 2 0 1 2 0 1 0 1 1 2 0 0 2 1 1 1 2 2 1 1 1 0 1 1 2 1 2 2 2 0 1 0 0 1 2 0 1 0 2 0 2 1 0 1 0 2 1 2 2 2 2 0 1 2 0 2 1 1 1 2 0 0 1 1 0 2 0 2 2 2 2 0 0 0 0 1 0 2 1 2 1 1 2 1 0 1 2 2 1 2 1 0 0 1 1 2 1 0 2 2 0 0 0 2 1 0 2 0 1 0 1 0 2 0 2 0 1 0 1 0 1 2 1 0 1 2 0 0 2 0 1 1 1 1 0 0 2 2 1 2...

output:

830948961894
830962691438
831089845804
831089777358
831103120890
831197150672
831207599421
831221036762
831238052959
831237947892
831228231087
831214453918
831200087238
831189163468
831179655054
831179714624
831166692113
831176318663
831188756291
831178154962
831178088610
831177966609
831178059867
8...

result:

ok 

Test #141:

score: 0
Accepted
time: 275ms
memory: 99324kb

input:

200000
2 2 2 2 0 0 1 1 0 0 0 1 1 1 1 1 2 1 0 1 0 1 2 2 1 1 0 1 2 1 2 1 1 2 1 2 2 1 1 2 1 0 0 1 2 1 1 0 1 0 2 1 1 0 1 1 0 0 2 1 1 2 2 2 2 2 0 1 2 1 2 0 0 1 2 0 0 0 0 2 1 1 0 2 2 1 2 0 1 2 2 1 2 2 1 2 2 0 1 1 0 1 2 2 1 2 0 1 0 2 2 2 1 1 1 1 2 0 0 1 2 0 2 1 2 1 2 0 0 1 0 1 1 1 0 1 1 2 2 2 0 1 0 1 1 2 0...

output:

4444780818
0
4444780818
0
0
4444780410
0
0
0
0
4444580199
0
0
0
4444513736
0
4444513736
4444514144
0
0
0
4444448085
0
4444448085
0
0
4444448488
0
4444448488
0
4444448488
4444515356
0
4444515356
0
4444515356
4444582224
0
0
4444582224
0
4444582224
0
0
0
4444582224
0
4444582224
0
0
0
0
0
4444648290
0
4...

result:

ok 

Test #142:

score: 0
Accepted
time: 310ms
memory: 99880kb

input:

200000
2 1 0 1 1 0 2 2 0 2 0 2 1 2 2 0 0 0 0 1 2 1 2 0 2 1 1 1 2 2 2 1 1 2 1 0 0 1 0 1 2 2 1 2 0 0 2 0 1 2 1 2 0 1 0 2 0 1 1 1 1 2 1 0 1 1 1 1 2 0 2 1 1 2 0 2 1 1 2 0 1 0 0 1 0 2 0 0 0 2 2 0 0 0 1 0 1 2 1 0 2 1 0 1 0 1 0 1 1 2 2 1 1 1 2 2 1 1 1 1 0 1 2 2 1 2 1 0 1 1 2 2 2 1 1 1 1 2 0 1 1 2 2 0 2 1 1...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 

Test #143:

score: 0
Accepted
time: 376ms
memory: 101140kb

input:

200000
1 2 1 2 2 1 1 1 2 2 1 1 1 2 1 2 1 2 1 1 1 1 2 2 2 1 1 2 2 2 0 1 2 2 2 2 1 2 2 2 2 1 1 1 1 2 1 1 0 0 2 1 2 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 1 2 2 1 2 2 2 1 2 1 2 1 1 2 2 1 1 2 1 1 2 2 1 1 1 1 1 1 2 2 2 2 1 1 1 1 2 1 2 0 1 2 2 1 2 1 2 2 2 2 1 1 2 2 1 2 1 0 1 1 2 2 1 1 1 1 1 0 1 1 1 1 2 2 2...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 

Test #144:

score: 0
Accepted
time: 358ms
memory: 100104kb

input:

200000
0 1 0 0 2 0 0 2 0 0 2 2 0 2 0 0 0 0 0 2 2 2 2 2 2 0 0 2 0 0 2 0 2 1 2 2 0 2 2 0 0 2 2 0 2 2 0 2 2 0 2 0 2 0 2 2 0 2 0 0 2 2 2 2 2 0 0 0 0 0 2 0 0 0 2 0 2 2 2 2 0 0 1 2 0 2 2 2 0 2 0 0 0 0 0 0 0 2 0 2 2 2 0 2 0 2 0 0 2 2 0 1 0 0 2 0 0 0 2 0 2 2 2 0 1 0 0 2 2 2 2 0 0 2 2 2 0 2 2 0 2 0 2 0 0 2 0...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 

Test #145:

score: 0
Accepted
time: 334ms
memory: 100152kb

input:

200000
0 1 1 0 1 1 1 1 0 0 0 1 1 1 2 1 0 0 0 0 0 0 0 2 0 0 0 0 0 1 2 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 2 0 0 1 0 1 1 0 0 0 0 0...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 

Extra Test:

score: 0
Extra Test Passed