QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#461446#3302. Just Meetinglegenc6yAC ✓297ms92676kbC++141.9kb2024-07-02 19:05:012024-07-02 19:05:03

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 71204kb

input:

4 2
1 2 5
2 4 3

output:

14

result:

ok single line: '14'

Test #2:

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

input:

4 4
1 2 10
1 3 20
2 4 30
3 4 40

output:

-1

result:

ok single line: '-1'

Test #3:

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

input:

130 247
21 130 9826251
113 14 6000798
73 55 6258090
52 88 9123162
58 57 1750276
41 40 1630609
104 103 1750276
5 61 8486225
47 52 9243976
65 64 746976
130 87 6380955
26 25 2351803
71 70 189606
47 49 4015464
49 48 1630609
87 63 5089117
124 58 9959337
73 20 3496765
78 34 7789869
69 68 2994591
96 95 208...

output:

-1

result:

ok single line: '-1'

Test #4:

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

input:

207 19
11 10 732134
5 4 444528
13 12 723858
17 16 64959
10 9 133983
9 8 661210
4 3 416495
15 14 740303
18 17 566802
19 18 692914
14 13 602221
16 15 144822
6 5 776502
7 6 570929
3 2 60173
20 19 486747
2 1 779525
8 7 606746
12 11 643657

output:

37712525

result:

ok single line: '37712525'

Test #5:

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

input:

186 269
142 141 5373289
66 65 4910100
110 109 7759528
94 93 2809357
50 49 1261298
2 1 5272448
146 145 602071
68 67 5272448
118 117 4022083
137 174 9510724
120 119 7808412
115 97 9942092
151 150 1261298
43 119 9650949
44 43 8315877
113 66 9166118
30 29 9014984
143 142 4621918
162 69 9459621
172 171 2...

output:

-1

result:

ok single line: '-1'

Test #6:

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

input:

291 20
4 3 2808901
10 9 573699
20 19 616858
8 7 1248928
9 8 483833
17 16 700554
6 5 455036
3 2 1779562
5 4 632027
11 10 1801411
15 14 661123
14 13 1224817
18 17 2104486
19 18 4193045
7 6 1540920
16 15 2216428
21 20 1670480
12 11 2433712
13 12 1935714
2 1 1079356

output:

140337842

result:

ok single line: '140337842'

Test #7:

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

input:

127 151
83 82 215103
52 51 128121
77 76 83069
87 40 2112995
10 9 158296
6 84 7414107
19 18 158296
126 125 180932
8 7 315382
4 3 158296
124 123 588493
61 60 154283
46 45 389333
52 27 1675967
90 89 552426
41 40 230260
41 36 8189327
48 47 257287
111 110 441447
35 34 158296
24 23 224466
37 36 6463039
16...

output:

-1

result:

ok single line: '-1'

Test #8:

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

input:

73 10
3 2 12608
11 10 82292
8 7 1581658
6 5 223002
4 3 131058
7 6 220313
10 9 1595495
5 4 722402
2 1 465004
9 8 942590

output:

13029938

result:

ok single line: '13029938'

Test #9:

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

input:

211 50
43 42 3354312
7 6 3216910
2 1 696369
25 24 1222424
51 50 2830101
35 34 1821861
33 32 1214397
39 38 4011606
28 27 1492176
46 45 1632220
5 4 1008492
17 16 2242236
18 17 2119279
21 20 1611326
47 46 1010910
23 22 4364287
19 18 364960
27 26 1487304
8 7 3361466
44 43 1691055
26 25 2407192
22 21 429...

output:

516852022

result:

ok single line: '516852022'

Test #10:

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

input:

200 265
21 61 4529486
55 54 3359530
139 138 2904011
142 141 2149180
102 101 1858872
88 87 3350392
198 197 1922055
100 99 1469856
37 36 3979928
45 44 3590367
81 80 952405
158 157 2527671
119 49 5353622
60 59 952405
185 184 3801765
11 10 1348271
72 195 4752711
40 39 4263919
187 199 9582700
18 12 89877...

output:

-1

result:

ok single line: '-1'

Test #11:

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

input:

194 192
86 85 3151812
67 66 3860526
101 100 3954555
15 14 2724016
157 156 2680597
31 30 1716299
129 128 845790
166 165 2257479
11 10 2302409
126 125 3609729
4 3 585471
96 95 611939
186 185 4710372
97 96 3562335
57 56 2024321
16 15 1388484
147 146 220786
63 62 4662185
161 160 4252836
109 108 4706726
...

output:

3181762668

result:

ok single line: '3181762668'

Test #12:

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

input:

163 111
14 13 3589778
77 76 4652253
10 9 5010585
73 72 2789197
31 30 3817748
23 22 3151559
111 110 4135513
25 24 970105
75 74 1515231
50 49 279316
79 78 2027052
76 75 4660194
38 37 4168082
52 51 8380363
36 35 874055
32 31 4723623
5 4 3714440
83 82 2971393
88 87 7920753
61 60 7459923
72 71 7390683
18...

output:

3338550669

result:

ok single line: '3338550669'

Test #13:

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

input:

179 247
61 10 6435117
27 26 4239625
84 83 3647344
68 67 2543825
60 59 1966036
39 38 4236287
5 4 2360004
105 104 1801120
16 15 5411043
135 134 4791690
57 56 445378
110 109 3114742
143 81 7141724
32 31 766026
55 54 5113099
132 131 1371746
32 105 6580855
107 106 6017616
136 130 9398144
54 104 8968672
1...

output:

-1

result:

ok single line: '-1'

Test #14:

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

input:

54 30
13 12 4451759
27 26 4442161
12 11 2398964
9 8 4222140
16 15 2851764
14 13 1091330
23 22 4925509
15 14 4995104
19 18 4155182
2 1 397633
25 24 5352138
10 9 1815947
11 10 1671289
21 20 140242
3 2 2736736
4 3 5656461
22 21 5107000
31 30 4404262
5 4 4634846
7 6 952910
28 27 2313494
17 16 5633144
24...

output:

459486801

result:

ok single line: '459486801'

Test #15:

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

input:

255 227
227 226 4920207
27 26 5037533
116 115 5343557
170 169 1256435
108 107 871150
47 46 3123564
132 131 1484411
74 73 3818355
38 37 5063371
104 103 4719554
65 64 5249186
32 31 4095684
86 85 55312
43 42 1482335
113 112 2654992
212 211 630537
163 162 5385315
53 52 3520896
171 170 3905741
61 60 4107...

output:

3433971899

result:

ok single line: '3433971899'

Test #16:

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

input:

130 284
59 58 5026899
29 53 9798603
21 20 5026899
81 110 9388568
19 18 5026899
103 28 7491797
126 39 8479438
48 33 7654948
11 80 9444096
14 103 9529861
5 78 9197396
59 29 9031977
79 78 6982901
37 36 5026899
105 104 5026899
50 49 5026899
107 106 6982901
48 9 8233156
102 128 8941370
34 69 8983296
56 6...

output:

-1

result:

ok single line: '-1'

Test #17:

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

input:

85 118
38 37 1209805
8 32 7722935
2 1 2288425
30 29 2433690
80 18 6869924
61 60 764819
71 70 1347315
53 52 401541
78 36 2656698
26 67 3714951
78 77 2296467
82 81 1999286
73 72 965011
68 67 401541
52 51 401541
59 58 1305475
24 23 672477
63 62 1209805
47 46 1887669
70 69 1945153
60 59 672477
7 6 83521...

output:

-1

result:

ok single line: '-1'

Test #18:

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

input:

57 93
32 49 7850550
4 10 8264827
46 44 9617973
55 50 8450736
39 38 4401567
47 46 2582579
45 44 7085748
24 23 2582579
31 42 8610501
35 4 7090329
46 15 9473646
40 39 4808728
52 51 1800643
26 25 4401567
5 4 6129129
44 43 2199256
15 45 9679645
43 42 1800643
4 3 3658022
46 45 5133878
21 27 9079232
30 54 ...

output:

-1

result:

ok single line: '-1'

Test #19:

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

input:

176 175
50 49 6513742
144 143 6684921
167 166 7484424
60 59 6719840
89 88 4294989
111 110 3246132
108 107 477840
107 106 4068020
37 36 6921678
124 123 6250225
122 121 7341465
140 139 4612622
115 114 2519935
7 6 426614
59 58 2754419
116 115 855318
27 26 7490466
138 137 3571427
45 44 4257340
130 129 4...

output:

4589580169

result:

ok single line: '4589580169'

Test #20:

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

input:

105 176
16 15 4418819
2 42 9243328
42 13 7188238
94 21 7640939
6 90 8922062
26 25 2066736
20 19 4889528
33 32 3105227
72 18 8068211
103 40 8203087
103 44 7362663
76 73 6708024
5 4 617845
65 64 2063666
49 48 3107775
97 96 4723373
96 95 360424
40 39 4215407
36 71 6450278
31 2 6580901
21 20 3513161
19 ...

output:

-1

result:

ok single line: '-1'

Test #21:

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

input:

215 291
209 92 7288216
41 7 7598611
69 54 8843697
44 43 1985267
203 202 1902691
130 129 3202004
4 3 2232443
85 135 4087266
93 107 7656574
197 52 6366254
206 26 8742958
202 17 4625111
146 145 1259292
176 175 1157932
40 39 558337
178 177 1605391
213 125 9053510
191 190 3380859
153 210 4384068
213 166 ...

output:

-1

result:

ok single line: '-1'

Test #22:

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

input:

262 126
3 2 3098795
103 102 8564219
83 82 6036829
115 114 6536092
79 78 8106175
24 23 165638
77 76 3620360
124 123 1049822
30 29 7061028
68 67 7410671
78 77 6214815
31 30 5535880
113 112 431145
5 4 37979
125 124 798280
38 37 3593923
28 27 1139498
102 101 2951859
45 44 5217969
23 22 5262433
74 73 170...

output:

3786295028

result:

ok single line: '3786295028'

Test #23:

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

input:

81 126
43 42 4154398
54 10 9252918
75 6 8019509
2 73 8141826
60 66 8956596
53 52 1715638
68 67 4586396
6 5 2057336
39 27 8261441
52 81 8374317
58 32 8070467
7 6 7306819
39 38 1715638
70 69 1715638
77 76 1715638
69 68 4559684
22 21 3052432
48 47 3869704
49 48 6519881
13 12 6783759
72 71 3052432
75 74...

output:

-1

result:

ok single line: '-1'

Test #24:

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

input:

110 263
67 16 9480464
5 106 9511889
108 10 9842482
14 13 6490170
52 51 5342373
75 106 8056903
75 74 6893255
89 19 8479985
39 96 9546633
14 27 9239970
51 12 9814502
85 62 8741653
55 54 3439003
41 40 3439003
58 46 7596137
13 12 5342373
72 12 9887214
109 29 8179889
26 22 8605520
75 104 8776782
24 85 79...

output:

-1

result:

ok single line: '-1'

Test #25:

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

input:

136 134
135 134 2766651
110 109 5856753
95 94 4429621
67 66 4689372
97 96 5491403
113 112 466996
122 121 2977090
9 8 1203322
114 113 4874015
98 97 5012384
36 35 4509561
15 14 4117114
120 119 691244
80 79 408170
79 78 1116052
106 105 2968691
3 2 1530925
24 23 2620341
59 58 3793740
77 76 3875449
35 34...

output:

3301143919

result:

ok single line: '3301143919'

Test #26:

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

input:

266 48
29 28 586556
20 19 552538
13 12 85788
27 26 201902
26 25 449501
35 34 310529
41 40 147033
38 37 608042
25 24 244512
8 7 282783
34 33 122795
18 17 339531
40 39 333255
2 1 269756
44 43 134084
37 36 710342
31 30 48165
3 2 213422
6 5 593630
36 35 285921
4 3 380396
42 41 692517
16 15 36741
12 11 4...

output:

79688769

result:

ok single line: '79688769'

Test #27:

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

input:

138 135
31 30 6462399
53 52 6521505
36 35 7560087
27 26 6523700
128 127 4135279
26 25 2267516
48 47 5633730
131 130 3649191
118 117 6590437
41 40 5992010
71 70 7325138
122 121 4403757
105 104 812024
94 93 4203569
64 63 1072970
120 119 3220712
86 85 7579735
60 59 2870886
84 83 4076556
135 134 4430326...

output:

3644785203

result:

ok single line: '3644785203'

Test #28:

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

input:

189 6
6 5 1674399
3 2 1099952
4 3 3296551
5 4 3000448
7 6 3977167
2 1 21314

output:

28966397

result:

ok single line: '28966397'

Test #29:

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

input:

105 168
22 21 1381889
25 72 8746469
32 2 4821499
38 1 5696587
33 70 8089763
28 27 801183
50 49 1548994
24 23 1013932
90 70 6159074
103 57 6345002
58 86 5488325
52 90 3194225
41 40 275771
26 25 801183
85 84 984628
93 92 1530617
53 52 1108971
104 103 1381889
56 1 3124366
58 49 3067932
102 101 1108971
...

output:

-1

result:

ok single line: '-1'

Test #30:

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

input:

31 206
3 7 8365285
1 6 9544049
1 25 8773283
13 31 8930943
31 30 8365285
11 27 8365285
26 31 8365285
20 16 8365285
30 26 8930943
10 4 9185480
26 4 8773283
11 24 8393277
30 4 8365285
28 21 8365285
27 10 8365285
30 10 8365285
21 30 8365285
18 28 8365285
29 19 8365285
11 16 8365285
22 25 8365285
8 15 83...

output:

-1

result:

ok single line: '-1'

Test #31:

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

input:

247 26
27 26 4727371
19 18 4488047
13 12 1748900
20 19 4283943
23 22 3014087
18 17 6572785
17 16 6089318
5 4 6207150
7 6 3635058
6 5 1481383
2 1 6646421
8 7 1404625
3 2 1138670
25 24 256171
10 9 2970148
15 14 7262305
9 8 6619556
26 25 4332493
16 15 5598491
4 3 3562409
12 11 1543514
21 20 7066703
24 ...

output:

629032100

result:

ok single line: '629032100'

Test #32:

score: 0
Accepted
time: 297ms
memory: 92676kb

input:

300000 300000
282382 282381 3148641
94384 94383 3148641
162159 162158 3148641
276002 276001 3148641
34111 34110 3148641
95098 95097 3148641
229144 229143 3148641
4779 4778 3148641
239092 239091 3148641
107595 107594 3148641
293286 293285 3148641
88743 88742 3148641
216793 216792 3148641
75237 75236 ...

output:

141688372703850000

result:

ok single line: '141688372703850000'

Test #33:

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

input:

19 171
15 3 9816118
12 5 9861342
14 6 9956040
18 1 9861342
18 12 9753180
14 2 9753180
17 16 9753180
15 10 9753180
10 17 9818685
15 1 9753180
2 18 9925601
16 19 9753180
19 9 9753180
5 4 9753180
5 9 9753180
2 17 9753180
19 11 9957361
3 17 9753180
14 19 9753180
10 3 9753180
18 7 9753180
4 10 9753180
13...

output:

-1

result:

ok single line: '-1'

Test #34:

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

input:

71 260
49 48 4271301
52 45 9642960
11 10 4271301
51 32 8660820
42 41 4271301
6 61 5584102
3 10 6951239
61 7 5874976
32 19 8822489
70 25 8968700
26 50 8598095
65 9 8239550
7 19 4271301
58 57 4271301
9 62 5753826
45 66 6936911
39 62 4271301
38 17 6699004
17 2 8059381
22 60 8059381
47 50 6699004
26 44 ...

output:

-1

result:

ok single line: '-1'

Test #35:

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

input:

220 291
152 82 9212597
178 216 9240671
150 193 9739465
28 27 4005563
114 113 3480168
120 119 7095139
203 202 4712304
137 178 8226641
28 8 9311560
101 73 9085577
113 53 9587072
118 165 8446112
217 216 2351662
73 72 2270426
183 182 987798
80 79 3115365
163 23 9771196
189 188 7461064
211 198 8276116
12...

output:

-1

result:

ok single line: '-1'

Test #36:

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

input:

277 275
97 96 6938568
141 140 7056667
35 34 7303819
231 230 2812757
33 32 2558964
216 215 5070482
69 68 3303492
252 251 6015023
133 132 7078117
244 243 6796276
110 109 7257527
239 238 6300388
72 71 1752238
263 262 1618411
3 2 253151
251 250 2215469
221 220 7333677
265 264 5309867
105 104 6190840
264...

output:

9872910272

result:

ok single line: '9872910272'

Test #37:

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

input:

237 206
25 24 814403
98 97 1267271
190 189 1087027
121 120 1111999
177 176 133628
113 112 528495
101 100 846868
145 144 629149
99 98 1157949
51 50 1165160
139 138 1093495
119 118 1021431
18 17 280275
206 205 507940
112 111 601932
140 139 844502
158 157 213756
118 117 807454
127 126 973298
169 168 97...

output:

1291941419

result:

ok single line: '1291941419'

Test #38:

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

input:

68 194
44 16 4046233
37 22 8908895
35 6 6725917
39 36 7313185
38 37 454242
30 7 1254084
15 66 4979463
62 47 1863510
26 59 7767655
23 68 7951566
2 63 6905333
55 40 6021290
36 35 654025
13 32 1254084
42 19 1863510
47 19 4979463
35 34 454242
22 51 3989702
19 11 5663114
58 47 5771212
38 25 3440636
7 10 ...

output:

-1

result:

ok single line: '-1'

Test #39:

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

input:

146 133
119 118 2260922
103 102 2304914
49 48 2525513
46 45 2307381
134 133 1541144
29 28 817135
78 77 2136580
115 114 1317894
16 15 2316262
65 64 2197694
77 76 2493110
126 125 1653019
38 37 297160
42 41 1556894
23 22 419107
118 117 1132552
59 58 2648239
2 1 1025113
94 93 1418529
18 17 1688020
99 98...

output:

1198579585

result:

ok single line: '1198579585'

Test #40:

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

input:

232 61
35 34 4585876
51 50 5315944
16 15 8392013
20 19 5396085
30 29 6679011
26 25 4478964
48 47 3405202
50 49 8348567
21 20 5419576
55 54 4022193
41 40 8060532
28 27 550945
61 60 926886
52 51 4593739
44 43 2470007
27 26 2262752
24 23 8696010
43 42 4210074
47 46 4134110
17 16 635371
58 57 6521167
37...

output:

2002371332

result:

ok single line: '2002371332'

Test #41:

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

input:

118 158
61 60 5197779
98 96 9456858
46 45 7947083
28 65 8348035
42 87 9300530
92 91 1961730
47 46 5521079
12 11 2996105
25 18 8698454
9 108 8816279
117 50 8194621
100 99 7068731
65 64 1582174
9 8 1871644
59 58 2846411
118 117 5505899
76 75 3650096
108 107 5164864
105 104 6686169
80 79 6753081
15 14 ...

output:

-1

result:

ok single line: '-1'

Test #42:

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

input:

48 26
11 10 6094936
27 26 6069788
24 23 2366074
2 1 5506983
6 5 3046255
13 12 7447933
16 15 6467342
15 14 6471999
14 13 4346088
26 25 1876347
4 3 7712295
5 4 1215720
22 21 558151
20 19 436824
8 7 2957197
23 22 8419127
25 24 7628584
10 9 5928858
9 8 6383759
12 11 3776655
19 18 2273266
21 20 8361595
7...

output:

602295912

result:

ok single line: '602295912'

Test #43:

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

input:

122 275
46 61 9126278
91 117 9300888
41 1 9734521
42 41 5110507
47 46 3952858
40 77 6658235
114 113 5110507
82 16 7777112
34 98 9307346
60 100 8873674
21 29 9681918
98 7 7967958
73 72 2886826
56 55 2434727
67 66 2434727
4 3 3952858
3 56 9810259
84 65 7118775
75 122 7876960
111 119 8039871
61 25 6591...

output:

-1

result:

ok single line: '-1'

Test #44:

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

input:

244 274
166 165 3033204
210 216 9960886
44 43 1199636
198 197 9700153
107 106 2682994
190 189 6280658
167 166 8038180
18 17 6708330
219 218 9864593
31 77 9923111
235 234 9602288
92 91 9253029
26 25 4743789
72 71 2248582
71 70 613223
123 122 7997811
89 88 4180436
126 125 7571041
240 239 9044100
80 79...

output:

-1

result:

ok single line: '-1'

Test #45:

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

input:

31 259
5 24 9772506
29 3 9813019
2 12 9928148
11 29 9397003
5 8 9397003
21 27 9397003
13 24 9397003
15 11 9397003
20 27 9818216
30 15 9728574
14 4 9915255
24 31 9397003
13 18 9397003
26 25 9397003
31 3 9397003
25 7 9397003
29 7 9933162
10 20 9397003
27 6 9397003
5 25 9397003
17 20 9397003
24 28 9397...

output:

-1

result:

ok single line: '-1'

Test #46:

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

input:

174 221
162 29 5004128
50 12 5719922
38 158 8646889
28 27 195503
108 107 145283
153 152 514508
163 162 246086
6 5 616794
120 136 6022605
112 148 3939591
7 52 8308794
89 88 670850
38 37 414852
4 3 229181
160 159 445255
138 137 86037
171 57 8695963
66 65 562303
54 53 640341
129 128 682755
125 124 4973...

output:

-1

result:

ok single line: '-1'

Test #47:

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

input:

189 238
14 13 89570
49 110 7669537
82 8 1372009
67 135 2653812
55 54 37961
82 81 304964
174 173 458843
112 111 360505
96 74 3693720
155 21 3995114
34 162 1495142
117 116 533356
173 172 207329
101 100 23421
8 7 345834
115 114 450555
5 4 184192
81 80 431483
163 162 517563
120 119 522557
62 61 386581
8...

output:

-1

result:

ok single line: '-1'

Test #48:

score: 0
Accepted
time: 7ms
memory: 71204kb

input:

199 70
56 55 4563935
57 56 4408896
42 41 2556398
62 61 3041123
15 14 4234401
16 15 895408
45 44 944588
49 48 4869480
68 67 3167411
19 18 3267399
2 1 2889646
47 46 1677744
29 28 701853
53 52 3242918
48 47 91752
67 66 5218012
70 69 2467740
24 23 404152
36 35 1243579
59 58 1462263
44 43 3737419
66 65 5...

output:

955086248

result:

ok single line: '955086248'

Test #49:

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

input:

154 84
49 48 156418
66 65 3796412
13 12 2538657
25 24 2867822
78 77 3670392
16 15 713127
56 55 371925
69 68 4056395
72 71 3082697
51 50 3177623
74 73 2591065
63 62 2125922
21 20 1291431
57 56 3167611
46 45 1059802
61 60 344045
26 25 2498518
6 5 193860
3 2 1582471
30 29 1664898
48 47 3485787
19 18 44...

output:

1028665678

result:

ok single line: '1028665678'

Test #50:

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

input:

259 185
38 37 5624722
167 166 5669117
129 128 6128113
102 101 387442
172 171 4187114
3 2 3069314
142 141 900793
94 93 4110884
63 62 5759266
48 47 5380759
185 184 6054658
128 127 4401462
50 49 2210888
107 106 848154
183 182 2437138
93 92 1469001
15 14 6143035
14 13 3682739
53 52 4170126
59 58 4457175...

output:

5323438960

result:

ok single line: '5323438960'

Test #51:

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

input:

272 25
8 7 3643478
15 14 440405
13 12 4501332
25 24 778462
17 16 3145162
23 22 4912993
26 25 2649196
7 6 4262242
14 13 2070124
21 20 269422
20 19 4146699
4 3 2377427
11 10 4710254
16 15 4835829
19 18 4474653
18 17 2218117
24 23 4643575
9 8 2362168
5 4 4726108
22 21 3928959
2 1 2931928
10 9 4875844
1...

output:

277495131

result:

ok single line: '277495131'

Test #52:

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

input:

293 73
48 47 1989233
5 4 2072987
25 24 2890328
59 58 2152162
74 73 233741
9 8 53347
23 22 1424930
18 17 83287
2 1 2251198
57 56 1560792
3 2 2783160
8 7 551896
37 36 779396
26 25 265364
7 6 1237694
72 71 156326
67 66 2949591
50 49 1795953
45 44 177671
22 21 592517
4 3 2540732
53 52 3144559
58 57 2063...

output:

499129561

result:

ok single line: '499129561'

Test #53:

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

input:

267 47
24 23 4964796
38 37 5493643
26 25 7954937
16 15 5500388
13 12 6973878
28 27 4543091
22 21 1355389
6 5 7760359
20 19 5876974
35 34 2833672
2 1 7511811
41 40 6292036
18 17 8147527
45 44 4981738
29 28 242501
27 26 165100
14 13 8130923
46 45 3386595
32 31 2871730
19 18 7273043
31 30 6808934
39 38...

output:

935844158

result:

ok single line: '935844158'

Test #54:

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

input:

7 21
2 4 8128465
5 7 8128465
2 6 8128465
1 6 9196680
3 5 8128465
7 2 9997706
4 3 8128465
4 6 8128465
6 5 8128465
3 2 8128465
7 4 8128465
5 4 8128465
1 4 8608975
5 1 9014397
7 3 8128465
7 6 8128465
6 3 8128465
2 1 8128465
1 7 8666935
1 3 8128465
5 2 8128465

output:

-1

result:

ok single line: '-1'

Test #55:

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

input:

249 296
173 172 2497562
145 94 9369342
237 236 1396767
199 106 8519505
76 75 2199969
48 47 5290797
125 124 6711450
239 238 5682440
188 104 8671648
200 234 8782982
109 155 8323409
230 229 7746630
189 188 4136349
119 118 1973527
215 214 864119
149 148 827430
21 20 3625617
28 27 6426457
129 128 8848782...

output:

-1

result:

ok single line: '-1'

Test #56:

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

input:

3 3
2 1 262803
3 2 262803
3 1 4975191

output:

5500797

result:

ok single line: '5500797'

Test #57:

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

input:

107 22
3 2 3552054
4 3 2835268
17 16 1033917
10 9 2606462
7 6 1228196
9 8 4968811
13 12 4546115
14 13 4699685
18 17 2238893
16 15 4160167
20 19 5772480
2 1 1880792
11 10 1036651
15 14 5817123
6 5 1175941
12 11 6345210
21 20 5497991
23 22 2690861
22 21 4155972
5 4 2013964
19 18 974840
8 7 5984622

output:

375743954

result:

ok single line: '375743954'

Test #58:

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

input:

277 172
30 29 1937111
88 87 3249721
31 30 2600487
4 3 2746319
53 52 3079229
167 166 1251238
82 81 1989565
87 86 1439497
37 36 2816404
110 109 2899251
48 47 2677935
2 1 2398306
79 78 383435
160 159 1199545
132 131 1400587
52 51 1983261
103 102 1484106
97 96 1873664
68 67 2268799
151 150 2279798
159 1...

output:

3188883707

result:

ok single line: '3188883707'

Test #59:

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

input:

93 288
73 72 2803072
71 85 9297555
60 59 2803072
78 11 8612616
15 14 2803072
42 37 5256388
62 55 7027254
55 70 5921357
93 8 8709590
6 35 8776860
10 54 8527069
86 44 7901325
16 32 4008652
69 68 2803072
49 48 2803072
62 61 2803072
50 91 4008652
52 38 6646928
85 63 7750921
52 32 7901325
8 72 6054660
30...

output:

-1

result:

ok single line: '-1'

Test #60:

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

input:

138 200
26 25 4421128
75 65 8598446
129 119 6318759
97 41 6875182
41 40 235838
60 59 2961569
10 9 4542361
134 133 3447571
134 21 6961785
27 45 7181920
55 9 6613759
86 69 5634955
56 55 1415205
65 64 2654052
29 28 3131819
129 128 4508480
32 31 802354
75 74 4324010
73 64 5512416
6 30 5575482
110 109 37...

output:

-1

result:

ok single line: '-1'

Test #61:

score: 0
Accepted
time: 7ms
memory: 71164kb

input:

2763 380
84 83 1617950
201 200 1548948
114 113 5576064
2 1 7322033
297 296 2519833
235 234 5557982
93 92 3732329
3 2 5795965
272 271 728568
171 170 779924
87 86 3530890
359 358 7506258
81 80 2908845
343 342 1793703
92 91 6667855
329 328 3455919
228 227 2544699
103 102 3593779
353 352 5516512
197 196...

output:

12924551612

result:

ok single line: '12924551612'

Test #62:

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

input:

2340 1272
797 796 1332821
36 35 566293
568 567 57084
894 893 625204
1073 1072 563555
915 914 1570692
794 793 133054
906 905 796202
363 362 1254210
519 518 1257968
474 473 1454388
232 231 389621
623 622 951175
1055 1054 1351619
267 266 1644700
575 574 1152161
533 532 91303
467 466 363586
91 90 456875...

output:

11859658917

result:

ok single line: '11859658917'

Test #63:

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

input:

2787 760
599 598 3066034
268 267 1133579
102 101 3103602
127 126 1949707
37 36 2968700
630 629 242019
34 33 991758
228 227 3735164
731 730 2168291
647 646 1226787
597 596 2397159
335 334 3057570
745 744 4445401
338 337 3854304
137 136 2100175
63 62 2491626
121 120 2722726
448 447 2975411
16 15 43437...

output:

16773969285

result:

ok single line: '16773969285'

Test #64:

score: 0
Accepted
time: 7ms
memory: 73308kb

input:

1555 1016
769 768 4478453
25 24 2691842
683 682 4503144
532 531 3407351
530 529 4382175
572 571 1827149
133 132 33149
147 146 153974
903 902 3623210
48 47 2754414
424 423 3803118
211 210 4470989
285 284 5991693
756 755 5369087
791 790 1013458
724 723 3882980
256 255 4132566
91 90 4391026
706 705 589...

output:

24711578134

result:

ok single line: '24711578134'

Test #65:

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

input:

279 1421
238 237 8500646
18 88 8500646
95 121 9783734
34 33 8500646
180 216 9487335
261 94 9819923
175 121 9210801
180 270 8808626
184 268 9475286
246 195 9444112
153 237 9210801
51 29 9656279
170 160 9876495
186 185 8500646
145 42 8500646
274 273 8500646
263 262 8500646
80 194 9957756
26 76 9326089...

output:

-1

result:

ok single line: '-1'

Test #66:

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

input:

1243 250
158 157 6398057
183 182 6967738
10 9 898630
163 162 6660986
44 43 309074
58 57 4458413
174 173 2351894
97 96 2071102
167 166 2779699
157 156 5153731
229 228 5763225
51 50 4202443
115 114 6217417
63 62 2943546
182 181 578987
40 39 2934609
165 164 3192902
148 147 6878253
137 136 5721190
179 1...

output:

8328051226

result:

ok single line: '8328051226'

Test #67:

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

input:

1406 63
41 40 411179
44 43 38305
5 4 90722
43 42 654436
34 33 302223
20 19 262345
24 23 198314
4 3 634823
53 52 83126
28 27 710701
13 12 506790
25 24 625803
55 54 543082
17 16 763792
48 47 617170
8 7 537929
16 15 510882
57 56 523119
11 10 570767
15 14 651034
58 57 757764
14 13 562555
3 2 744804
46 4...

output:

129531007

result:

ok single line: '129531007'

Test #68:

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

input:

450 1822
369 368 5911101
34 4 6544343
200 249 6718822
172 204 7958540
176 175 5911101
101 100 5911101
112 89 7414041
335 50 7110094
339 395 9131382
244 39 8949498
57 348 8269637
82 57 6718822
382 282 9060083
226 70 7537514
50 317 8348827
199 232 6544343
320 174 9208229
103 397 7835766
77 10 6978265
...

output:

-1

result:

ok single line: '-1'

Test #69:

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

input:

214 2567
110 163 9809243
31 109 9987174
183 182 9809243
73 107 9872342
163 162 9809243
103 127 9809243
90 116 9809243
214 213 9809243
93 136 9932410
79 64 9985540
43 52 9809243
122 172 9872342
15 14 9809243
151 112 9908346
178 171 9809243
77 124 9809243
84 203 9809243
59 23 9872342
140 1 9809243
206...

output:

-1

result:

ok single line: '-1'

Test #70:

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

input:

1812 223
38 37 376625
28 27 1082677
179 178 795186
72 71 903
208 207 321550
165 164 1147173
153 152 139463
154 153 1314202
44 43 1084831
173 172 1018729
160 159 1185353
118 117 393086
207 206 1245801
155 154 720921
34 33 613792
4 3 975255
210 209 254081
120 119 497946
17 16 214383
61 60 401850
149 1...

output:

1483854148

result:

ok single line: '1483854148'

Test #71:

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

input:

1891 271
34 33 6643942
58 57 8807303
20 19 9001309
51 50 406496
191 190 6692744
72 71 3561249
52 51 9377752
70 69 5949609
236 235 8211360
227 226 3432952
268 267 6895290
43 42 1717030
194 193 5421023
84 83 4757765
202 201 8205448
92 91 2580686
83 82 4850470
54 53 4368002
8 7 3130573
57 56 9252272
66...

output:

9560771912

result:

ok single line: '9560771912'

Test #72:

score: 0
Accepted
time: 8ms
memory: 73184kb

input:

88 412
38 37 9726935
43 42 9549801
64 16 9861129
21 17 9549801
65 23 9862475
77 32 9549801
46 51 9991422
13 12 9549801
80 35 9990445
51 63 9549801
68 15 9866962
81 36 9549801
57 9 9848582
52 58 9549801
61 49 9857794
33 45 9852739
39 60 9726935
4 8 9855572
32 44 9549801
87 83 9908744
39 20 9633963
14...

output:

-1

result:

ok single line: '-1'

Test #73:

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

input:

1058 984
839 838 1968412
307 306 1068954
589 588 460361
732 731 1608622
92 91 440109
52 51 370638
733 732 2266205
887 886 1240028
735 734 2265344
329 328 495953
770 769 155897
423 422 1780330
646 645 1093662
95 94 1493860
147 146 997217
750 749 2094076
354 353 1286082
238 237 451113
705 704 1366962
...

output:

14062169804

result:

ok single line: '14062169804'

Test #74:

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

input:

1387 579
572 571 1632048
449 448 1992638
195 194 2422232
244 243 872733
478 477 1482353
153 152 2393056
412 411 2031927
132 131 421094
93 92 343127
267 266 813503
510 509 2595416
291 290 3277004
135 134 2590959
495 494 3077859
570 569 2908548
209 208 1652896
178 177 310470
118 117 866795
251 250 293...

output:

12002252657

result:

ok single line: '12002252657'

Test #75:

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

input:

1999 2620
674 1868 415753
1343 1342 118364
1814 1813 244939
1040 1039 220444
1177 1176 119711
600 599 85401
516 515 61802
1927 1329 7049285
885 884 273304
1197 801 5779790
1575 1574 92048
759 496 3466266
1921 1920 216744
842 841 320209
1398 1347 3830840
1692 107 6664653
1376 1375 297829
1107 1106 22...

output:

-1

result:

ok single line: '-1'

Test #76:

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

input:

471 2977
188 333 9995255
71 70 9189464
450 354 9540911
319 27 9882349
35 66 9896099
427 13 9189464
27 320 9783414
420 471 9277688
217 422 9189464
362 427 9689410
263 222 9189464
143 73 9189464
392 179 9646851
281 394 9555026
323 228 9466852
430 365 9189464
254 43 9512805
20 331 9915048
97 313 918946...

output:

-1

result:

ok single line: '-1'

Test #77:

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

input:

2761 2751
144 143 1214160
1105 1104 7018902
832 831 1049490
1967 1966 1451759
795 794 3456473
2561 2560 60333
1424 1423 5418540
1587 1586 7211295
50 49 3024249
445 444 5226048
2134 2133 1121860
1047 1046 1052570
2424 2423 5492803
1099 1098 4452858
245 244 2072165
2722 2721 7011488
1524 1523 222528
1...

output:

125578688111

result:

ok single line: '125578688111'

Test #78:

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

input:

2130 931
279 278 1030449
493 492 5525371
771 770 2002990
828 827 1331547
374 373 2731716
579 578 91107
13 12 3930952
207 206 1185440
139 138 911623
46 45 2130052
30 29 2430716
409 408 5380538
841 840 5596525
846 845 4987668
295 294 1293549
444 443 4950243
309 308 5276509
73 72 4981127
657 656 547223...

output:

39587038352

result:

ok single line: '39587038352'

Test #79:

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

input:

2153 357
177 176 670252
241 240 497417
283 282 688051
225 224 431594
298 297 66652
5 4 532176
268 267 310303
254 253 736273
312 311 474980
198 197 677635
84 83 522330
79 78 455703
331 330 521694
99 98 296026
260 259 247887
271 270 280148
109 108 421033
323 322 292266
62 61 475980
248 247 724583
21 2...

output:

1115948802

result:

ok single line: '1115948802'

Test #80:

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

input:

2636 1589
1139 1138 224989
503 502 1902041
1560 1559 1745072
244 243 3377424
1203 1202 2539160
1196 1195 1677401
1353 1352 4940553
951 950 400693
1251 1250 3149214
1378 1377 3797711
1425 1424 3945191
1491 1490 5845401
440 439 5967458
236 235 1211148
688 687 3328577
733 732 149844
1294 1293 5781146
1...

output:

70094027010

result:

ok single line: '70094027010'

Test #81:

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

input:

286978 65345
43640 43639 5370967
30771 30770 5651386
22319 22318 2156812
45736 45735 4209840
57257 57256 1749458
60998 60997 5664990
59122 59121 7055103
63687 63686 322742
3120 3119 2695663
16422 16421 873859
27586 27585 4128582
51963 51962 152701
43611 43610 6566950
11236 11235 297356
817 816 64901...

output:

4287498932039

result:

ok single line: '4287498932039'

Test #82:

score: 0
Accepted
time: 31ms
memory: 71636kb

input:

6621 143570
6016 6015 8400670
1120 4905 8400670
1533 2586 9338923
2763 4149 8400670
5141 6020 8400670
6557 6067 9526775
5996 3559 8400670
3229 2358 8400670
2017 2557 8990295
5084 4819 9177647
2517 5320 9215556
3283 888 8400670
1420 5996 9327388
3299 4330 8400670
532 6237 8400670
3726 89 8400670
1629...

output:

-1

result:

ok single line: '-1'

Test #83:

score: 0
Accepted
time: 113ms
memory: 81848kb

input:

122958 200141
70742 70741 1469302
90252 90251 990582
6595 6594 3221626
82259 82258 1404591
25143 79632 3893228
47682 94905 9618269
64868 120612 5915767
1561 103423 9070714
26115 26114 358794
25712 25711 3098223
112408 112407 186524
60545 60544 772813
31074 109584 8227192
103607 103606 3199629
112770...

output:

-1

result:

ok single line: '-1'

Test #84:

score: 0
Accepted
time: 226ms
memory: 88704kb

input:

295922 231287
202340 202339 3965444
144095 144094 3927193
114465 114464 3152292
179593 179592 3816365
164449 164448 3732512
66822 66821 2921701
104172 104171 1424289
63234 63233 1387419
206528 206527 3679089
116662 116661 2458651
187590 187589 3162005
21506 21505 1182797
101446 101445 3582646
742 74...

output:

11377303850052

result:

ok single line: '11377303850052'

Test #85:

score: 0
Accepted
time: 81ms
memory: 81448kb

input:

284577 108842
71286 71285 2511442
18285 18284 6790155
16643 16642 2936809
19965 19964 2625551
34022 34021 2064860
15751 15750 1535017
85814 85813 4150525
44246 44245 3037170
18511 18510 466547
97053 97052 575698
40168 40167 5528340
68296 68295 123894
31767 31766 5515941
2256 2255 4330483
107348 1073...

output:

7715747318220

result:

ok single line: '7715747318220'

Test #86:

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

input:

51630 4133
373 372 1873637
2078 2077 1206579
278 277 2165100
1374 1373 2035521
2624 2623 1085479
227 226 1872113
3198 3197 1367300
3796 3795 1054359
3376 3375 2098624
3851 3850 1538913
3107 3106 1674915
3803 3802 1831838
1985 1984 363375
3542 3541 1853897
1933 1932 1481757
3553 3552 1488692
1195 119...

output:

78698498477

result:

ok single line: '78698498477'

Test #87:

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

input:

287628 26223
22265 22264 84074
18820 18819 1849581
3815 3814 1859748
6729 6728 1618068
8178 8177 257604
4518 4517 794295
6629 6628 1310522
24458 24457 1124579
22684 22683 283428
18173 18172 1168819
10289 10288 600829
3765 3764 571058
13870 13869 1303587
23363 23362 1197944
21091 21090 1278857
11355 ...

output:

495279601391

result:

ok single line: '495279601391'

Test #88:

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

input:

288599 268275
122693 122692 7288507
204482 204481 1425978
90537 90536 6041760
4139 4138 3905475
135203 135202 3856102
39680 39679 179449
99886 99885 3542568
53456 53455 1183562
10675 10674 3699921
143117 143116 2380711
37866 37865 4466289
216561 216560 6806684
185910 185909 3176864
209350 209349 711...

output:

24147861096679

result:

ok single line: '24147861096679'

Test #89:

score: 0
Accepted
time: 86ms
memory: 81592kb

input:

274255 129080
57366 57365 7699907
36780 36779 7866225
88539 88538 8361459
119221 119220 5176132
46652 46651 1696941
49248 49247 5787460
123358 123357 4940493
128622 128621 6609418
117202 117201 8272084
126322 126321 7190294
111879 111878 8593738
10959 10958 1679757
4985 4984 5693315
8624 8623 643278...

output:

13453680438058

result:

ok single line: '13453680438058'

Test #90:

score: 0
Accepted
time: 32ms
memory: 71320kb

input:

2525 175057
1414 2506 9943874
1913 854 9943874
1115 2061 9943874
1303 1704 9943874
1036 2011 9943874
59 2397 9943874
1412 1384 9943874
1744 1413 9943874
2257 833 9943874
713 1751 9943874
280 336 9943874
2230 76 9943874
1181 1653 9943874
309 1115 9943874
372 1060 9943874
2428 1815 9943874
339 2248 99...

output:

-1

result:

ok single line: '-1'

Test #91:

score: 0
Accepted
time: 129ms
memory: 82848kb

input:

123104 292969
29302 34985 9376926
81707 99473 7206578
25706 25705 4551955
45115 45114 5265109
74517 74516 3026354
113046 56880 8500423
7915 14030 9868718
117700 117699 3412531
70376 37429 6330931
16989 16988 115919
24475 113188 7923586
86577 86576 3594223
23456 23455 1592493
118335 118334 403896
116...

output:

-1

result:

ok single line: '-1'

Test #92:

score: 0
Accepted
time: 74ms
memory: 81356kb

input:

98661 168929
57068 57067 4782103
88021 88020 5081898
44476 44475 565777
53448 53447 5163010
74467 74466 7791841
11920 69688 8090923
76833 97755 8168907
74827 78072 8064732
84107 84106 7901426
55017 46556 8582570
72505 72504 3042930
86988 34021 8126196
7889 7888 145491
5184 5183 4082983
33914 53818 9...

output:

-1

result:

ok single line: '-1'

Test #93:

score: 0
Accepted
time: 57ms
memory: 79576kb

input:

262883 89936
9329 9328 1000537
2679 2678 3533706
52748 52747 49271
17568 17567 4260225
28246 28245 788474
88999 88998 2949997
11294 11293 145582
41731 41730 715048
36344 36343 2074403
73611 73610 4389013
73369 73368 1417804
13079 13078 2294490
6088 6087 822790
1699 1698 2292210
67736 67735 3699481
1...

output:

3971523626032

result:

ok single line: '3971523626032'

Test #94:

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

input:

294137 89094
88620 88619 1712351
43715 43714 2763685
76436 76435 4083442
37964 37963 2661591
44415 44414 4831312
31820 31819 3222576
79280 79279 5786979
81287 81286 5592245
43319 43318 144789
25941 25940 3939570
57016 57015 2999524
50667 50666 6018041
44250 44249 4092317
30346 30345 5860410
15894 15...

output:

5784299306398

result:

ok single line: '5784299306398'

Test #95:

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

input:

7419 238677
543 2657 9094283
4519 4518 9094283
7127 3482 9094283
2671 466 9094283
3346 658 9094283
391 738 9819929
371 4782 9094283
3598 4338 9094283
363 1181 9094283
5789 4017 9094283
4228 1035 9094283
2950 4406 9094283
5456 4455 9758968
6649 6648 9094283
6704 4135 9149653
4163 269 9330123
1902 492...

output:

-1

result:

ok single line: '-1'

Test #96:

score: 0
Accepted
time: 71ms
memory: 74940kb

input:

26952 278644
4157 4156 6463805
2890 23179 6463805
17740 17739 6463805
937 18671 6463805
26218 12505 6463805
3271 13635 6950436
2557 25375 7178791
8877 26689 8771700
24294 24572 7622422
212 22311 9337081
2663 6753 9573090
3611 3610 6463805
12569 17971 6463805
7378 475 9221665
22309 19763 6463805
1054...

output:

-1

result:

ok single line: '-1'

Test #97:

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

input:

213372 255
179 178 1199233
243 242 878490
100 99 21258
200 199 634732
237 236 1044082
166 165 432412
244 243 846406
198 197 687363
17 16 1140134
126 125 280344
105 104 960215
14 13 586768
206 205 755510
101 100 1145115
48 47 450758
195 194 539272
171 170 163849
49 48 703529
167 166 606915
2 1 199109...

output:

23752745196

result:

ok single line: '23752745196'

Test #98:

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

input:

298283 152503
96126 96125 1575585
133825 133824 1658524
101321 101320 758979
19847 19846 108222
149738 149737 945623
138312 138311 1585299
10289 10288 924481
113664 113663 1055557
117678 117677 1075918
142082 142081 965018
121137 121136 82105
129662 129661 663412
66951 66950 1579972
43560 43559 2782...

output:

3445156476044

result:

ok single line: '3445156476044'

Test #99:

score: 0
Accepted
time: 156ms
memory: 86008kb

input:

284332 191950
82408 82407 272958
64572 64571 2628241
115240 115239 1700664
101079 101078 5827894
129570 129569 3200130
131719 131718 4707464
144841 144840 655724
171787 171786 675939
151491 151490 3836547
20534 20533 2076524
16563 16562 3883800
54942 54941 302051
167050 167049 2860656
129226 129225 ...

output:

13418907275862

result:

ok single line: '13418907275862'

Test #100:

score: 0
Accepted
time: 167ms
memory: 87000kb

input:

182087 242416
57670 120013 9555274
5797 5796 3595272
121786 121785 6983844
75602 75601 2546841
70442 70441 3869735
20510 97214 7932112
171865 171864 6908951
157769 157768 4269930
124336 124335 6717512
80502 80501 575695
70072 70071 5197166
15030 87893 8820558
123709 144804 8527380
128458 128457 4533...

output:

-1

result:

ok single line: '-1'

Test #101:

score: 0
Accepted
time: 41ms
memory: 77616kb

input:

33416 144631
26324 26323 563946
28596 20828 6668776
29209 730 8815461
30030 4612 7661061
25780 16587 8649328
28229 28228 5879864
20106 20105 563946
4261 28243 6502390
12148 20170 9308596
25072 17319 6487347
13726 13725 954758
5832 5831 4514498
21748 15424 9453439
8682 12897 9552454
26576 31561 79017...

output:

-1

result:

ok single line: '-1'

Test #102:

score: 0
Accepted
time: 106ms
memory: 83532kb

input:

161140 137813
26091 26090 196526
11585 11584 3553838
9554 9553 1450436
20980 20979 3032456
26164 26163 1627554
18968 18967 4043960
59123 59122 467724
6801 6800 655238
31702 31701 3112399
27550 27549 3266031
42647 42646 2063207
55203 55202 3618484
15691 15690 3655808
12032 12031 1164180
62529 62528 3...

output:

6097077378545

result:

ok single line: '6097077378545'

Test #103:

score: 0
Accepted
time: 200ms
memory: 89056kb

input:

212136 239953
12092 12091 2631415
180597 180596 1525521
113902 113901 7641454
23580 23579 4636048
149244 199745 9423716
199895 199894 1104990
150971 43968 9507585
166719 166718 4902350
9178 9177 2717829
185257 185256 7393734
11296 11295 7976198
74633 74632 253748
50683 50682 7865141
186713 186712 78...

output:

-1

result:

ok single line: '-1'

Test #104:

score: 0
Accepted
time: 194ms
memory: 88636kb

input:

190250 285074
96450 96449 534265
180562 180561 514052
172243 172242 754333
165412 165411 436693
105832 30816 8972145
137952 137951 309765
119787 119786 191310
151488 91058 6346354
12591 12590 455143
155567 155566 113275
140351 140350 504799
4969 147159 5457645
160202 160201 745370
178766 178765 5922...

output:

-1

result:

ok single line: '-1'

Test #105:

score: 0
Accepted
time: 9ms
memory: 73940kb

input:

214730 11509
6476 6475 4072646
5 4 229274
1548 1547 6150756
11479 11478 5571184
5785 5784 5414659
9195 9194 3987037
11203 11202 2168558
10217 10216 6005314
2302 2301 1721945
4258 4257 1965152
2522 2521 4524414
9256 9255 2332169
426 425 4879409
4725 4724 3030091
1772 1771 6070173
4616 4615 2631337
73...

output:

638089780526

result:

ok single line: '638089780526'

Test #106:

score: 0
Accepted
time: 169ms
memory: 87300kb

input:

277439 201353
126927 126926 754551
177850 177849 842944
98600 98599 1061565
21393 21392 29959
80172 80171 841179
31425 31424 1253289
185907 185906 1107063
163558 163557 604916
69906 69905 1056023
35051 35050 94162
73359 73358 330074
65881 65880 769099
163511 163510 837800
36673 36672 947052
170692 1...

output:

3243616410618

result:

ok single line: '3243616410618'

Test #107:

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

input:

261372 160499
84603 84602 2985063
45428 45427 264918
120789 120788 1947567
98649 98648 94232
154329 154328 1919789
158084 158083 2406094
10881 10880 2588191
139521 139520 2853543
122248 122247 1014265
92915 92914 367215
88489 88488 2468122
82707 82706 2776342
90705 90704 1163057
42227 42226 2037112
...

output:

5142969194373

result:

ok single line: '5142969194373'

Test #108:

score: 0
Accepted
time: 249ms
memory: 91164kb

input:

285031 265933
253652 253651 2326204
197129 197128 189327
187354 187353 431390
26231 26230 1071014
171557 171556 1561120
145251 145250 2032898
181451 181450 40421
241364 241363 1451459
198277 198276 105674
132675 132674 1185286
145569 145568 1372278
12075 12074 2420324
3399 3398 239841
77582 77581 77...

output:

6644343486102

result:

ok single line: '6644343486102'

Test #109:

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

input:

261231 115379
105853 105852 6862414
100417 100416 1562981
505 504 3831572
33887 33886 2972789
40844 40843 6719086
15078 15077 4536005
52305 52304 1777127
23615 23614 3685950
112120 112119 1375676
19793 19792 4509562
13325 13324 4110276
93283 93282 7339200
80239 80238 6731607
45461 45460 893390
10131...

output:

9971127303574

result:

ok single line: '9971127303574'

Test #110:

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

input:

190688 166524
68910 68909 341209
7625 7624 605725
9899 9898 56797
98107 98106 726194
157434 157433 436118
103831 103830 283966
72013 72012 535322
126964 126963 617649
17731 17730 416988
44946 44945 625000
108005 108004 691657
116596 116595 357980
23957 23956 731519
88377 88376 244816
141970 141969 3...

output:

1415311912128

result:

ok single line: '1415311912128'

Test #111:

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

input:

250734 300000
151559 151558 3651606
236479 236478 3651606
83168 83167 3651606
180513 180512 3651606
77952 122089 3651606
5626 5625 3651606
22619 22618 3651606
60730 243077 3651606
210548 188156 3651606
159505 159504 3651606
123840 123839 3651606
134049 134048 3651606
239293 239292 3651606
226094 392...

output:

114783283072431666

result:

ok single line: '114783283072431666'

Test #112:

score: 0
Accepted
time: 243ms
memory: 88980kb

input:

212080 300000
89283 155921 9824982
209243 209242 9824982
112296 112295 9824982
209916 209915 9824982
137070 137069 9824982
143671 148902 9824982
17683 133250 9824982
5255 5254 9824982
123451 123450 9824982
159832 159831 9824982
178572 5385 9824982
134259 134258 9824982
178923 178922 9824982
112257 1...

output:

220952616797571120

result:

ok single line: '220952616797571120'

Test #113:

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

input:

227312 300000
71437 71436 727794
100920 100919 727794
166207 166206 727794
6012 6011 727794
104979 104978 727794
30100 30099 727794
20353 20352 727794
180259 45490 727794
152358 152357 727794
211316 211315 727794
208219 208218 727794
48549 48548 727794
215676 67338 727794
170854 85920 727794
43566 2...

output:

18802746500290704

result:

ok single line: '18802746500290704'

Test #114:

score: 0
Accepted
time: 295ms
memory: 92480kb

input:

279660 300000
270024 170715 4467654
274143 274142 4467653
31342 31341 4467653
260004 260003 4467654
150965 150964 4467653
249492 249491 4467653
238417 238416 4467654
186865 186864 4467654
5275 110371 4467653
127167 194575 4467653
85998 85997 4467653
202986 202985 4467654
10059 94175 4467653
61383 61...

output:

174706310553220921

result:

ok single line: '174706310553220921'

Test #115:

score: 0
Accepted
time: 225ms
memory: 90568kb

input:

223511 300000
67719 67718 1169521
209090 209089 7134220
205434 205433 7444041
141919 141918 1066234
95992 95991 1770513
191706 191705 6709429
214483 136949 9169124
204673 204672 2479094
134662 134661 9035778
100535 100534 3161378
200448 200447 7817986
38214 143039 9169124
37965 40457 9169124
178981 ...

output:

-1

result:

ok single line: '-1'

Test #116:

score: 0
Accepted
time: 82ms
memory: 78528kb

input:

63458 206725
42342 8902 9914641
47047 9942 9964904
34926 47409 9675811
61691 61690 6257582
11978 3087 9647188
876 7608 9630919
51131 35041 9914231
36031 53256 9658431
18794 27681 9818471
20279 11862 9957113
40046 40045 3510500
1936 49040 9621613
34958 15461 9618986
17121 14427 9691808
16186 51391 98...

output:

-1

result:

ok single line: '-1'

Test #117:

score: 0
Accepted
time: 16ms
memory: 74472kb

input:

167842 19443
1465 1464 3734439
5451 5450 1790430
10535 10534 858053
4521 4520 1605618
9574 9573 706731
16049 16048 689105
10374 10373 2427897
9042 9041 538783
15819 15818 3573043
18980 18979 520541
13381 13380 1673504
1911 1910 1826741
1930 1929 1048466
13180 13179 1351826
11641 11640 2265079
17627 ...

output:

624610087577

result:

ok single line: '624610087577'

Test #118:

score: 0
Accepted
time: 36ms
memory: 76232kb

input:

151651 48158
20361 20360 1824349
19806 19805 1423816
4506 4505 4147882
34938 34937 7008532
38897 38896 4260672
30040 30039 6891864
17766 17765 5670916
43979 43978 7064453
11507 11506 1906091
25981 25980 1066046
45121 45120 2554800
33391 33390 7266486
25748 25747 6131232
39112 39111 259284
1863 1862 ...

output:

3135499193180

result:

ok single line: '3135499193180'

Test #119:

score: 0
Accepted
time: 200ms
memory: 87720kb

input:

270079 218740
42049 42048 1558765
177485 177484 5319088
168325 168324 2260882
32445 32444 5050351
124668 124667 2682282
93404 93403 5248405
81332 81331 769365
159938 159937 1159454
96753 96752 1012450
96842 96841 4984117
167805 167804 3188572
69459 69458 5293961
42873 42872 1382786
79996 79995 41634...

output:

13131209440299

result:

ok single line: '13131209440299'

Test #120:

score: 0
Accepted
time: 264ms
memory: 91120kb

input:

295329 263198
107631 107630 6852633
142853 142852 4224478
186716 186715 2966137
115330 115329 6542237
187370 187369 3966668
106203 106202 1800039
151671 151670 7255930
4814 4813 6995146
252927 252926 8374957
176032 176031 1184021
178101 178100 3565347
258061 258060 7210871
3561 3560 5764528
82206 82...

output:

25717528482458

result:

ok single line: '25717528482458'

Test #121:

score: 0
Accepted
time: 174ms
memory: 87164kb

input:

255861 205717
186590 186589 1413419
196725 196724 183885
8558 8557 92543
88342 88341 77210
203119 203118 1136820
20163 20162 1206920
120293 120292 1119456
201702 201701 914379
49765 49764 894595
135135 135134 588277
110874 110873 606381
20614 20613 1027552
199545 199544 803809
120754 120753 1070877
...

output:

3471978105274

result:

ok single line: '3471978105274'

Test #122:

score: 0
Accepted
time: 262ms
memory: 91668kb

input:

265047 284635
113187 113186 2299498
22537 22536 997992
3767 3766 2051125
88879 88878 2567182
53201 53200 1783169
201169 201168 319140
102712 102711 1762384
152729 152728 1241264
46421 46420 2695864
119984 119983 5826
71882 71881 1232837
255354 255353 76359
174260 174259 1303008
76223 76222 2233557
1...

output:

-1

result:

ok single line: '-1'

Test #123:

score: 0
Accepted
time: 43ms
memory: 77448kb

input:

242393 62036
27310 27309 4855771
49174 49173 705864
50112 50111 3000296
31558 31557 5565278
37125 37124 8015862
15436 15435 4777141
17600 17599 7868406
17268 17267 6806770
18550 18549 6341691
23706 23705 1416461
5995 5994 6273269
34443 34442 1307481
11216 11215 1883784
36883 36882 5168710
56062 5606...

output:

4718527589421

result:

ok single line: '4718527589421'

Test #124:

score: 0
Accepted
time: 138ms
memory: 83836kb

input:

186770 167504
92651 92650 2125354
126170 126169 978988
157969 157968 4159381
140834 140833 2742156
69776 69775 4601295
86100 86099 3482845
160769 160768 1136505
56551 56550 4284597
42599 42598 3707983
88072 88071 1964450
85700 85699 3049255
38301 38300 5433679
154408 154407 369475
133279 133278 4632...

output:

12178608781410

result:

ok single line: '12178608781410'

Test #125:

score: 0
Accepted
time: 36ms
memory: 77464kb

input:

79289 46071
39082 39081 3433003
41084 41083 3040011
23690 23689 2543891
32510 32509 3519789
43935 43934 4503912
44241 44240 5015033
7106 7105 3606670
39500 39499 1090660
11718 11717 4974451
42660 42659 40884
37146 37145 1181312
40239 40238 5250475
9147 9146 2911014
29223 29222 4306165
18265 18264 14...

output:

2573388377464

result:

ok single line: '2573388377464'

Test #126:

score: 0
Accepted
time: 81ms
memory: 80264kb

input:

123369 112255
103245 103244 5239747
28565 28564 2648312
101414 101413 5335525
7273 7272 1167951
14763 14762 407237
105762 105761 7166444
25914 25913 5471283
8638 8637 1747634
111212 111211 2613718
95759 95758 7492319
21286 21285 8155502
72443 72442 6968697
61121 61120 4953263
86610 86609 2493127
309...

output:

9516179868607

result:

ok single line: '9516179868607'

Test #127:

score: 0
Accepted
time: 28ms
memory: 75940kb

input:

185331 41954
10699 10698 1344173
36548 36547 1603631
27399 27398 278514
19053 19052 1692121
33976 33975 684382
3610 3609 465868
36035 36034 14123
10203 10202 32561
34117 34116 1210154
31987 31986 1882573
18416 18415 825018
21145 21144 1415420
11968 11967 148512
39962 39961 1082883
29420 29419 119567...

output:

728375311721

result:

ok single line: '728375311721'

Test #128:

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

input:

61967 271191
2713 26131 5526631
42882 18114 9233498
25098 2807 8185085
31758 1974 4639288
48278 26424 9079601
50547 24844 8921009
10322 558 4412557
34054 34053 1692936
49020 49019 2509991
32093 37546 5004096
55915 11071 7459816
14352 57856 6756992
56958 36302 7241260
19262 29171 5604156
40326 61154 ...

output:

-1

result:

ok single line: '-1'

Test #129:

score: 0
Accepted
time: 181ms
memory: 86256kb

input:

268038 191611
31980 31979 686090
28283 28282 1459136
102351 102350 1417170
137356 137355 423510
25335 25334 1475474
128338 128337 915833
16740 16739 399972
191372 191371 1244147
130631 130630 1121129
56288 56287 465320
38273 38272 855363
69430 69429 18330
41013 41012 1197879
1488 1487 141687
144995 ...

output:

3182054701293

result:

ok single line: '3182054701293'

Test #130:

score: 0
Accepted
time: 134ms
memory: 81844kb

input:

107018 293143
47179 44184 8079259
28796 78015 7255065
58059 58058 2661672
61191 61190 2659406
62022 65458 8057114
104414 100856 8398063
89945 89944 2037637
21727 21726 1053797
89817 89816 223728
38159 44418 7405337
81476 73203 6871568
6707 17143 9508240
82632 42850 8070424
2803 2802 1011327
11225 71...

output:

-1

result:

ok single line: '-1'