Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr


        

Hints

Your answer may be identical to the JOJ answer in the first several lines.

However, you will still get Wrong Answer because the complete output may be longer and there might be errors in the future lines.

Please double check your code to solve this problem and try again.

Your Answer

275
181
285
400
205
349
462
909
489
461
292
229
929
1324
376
319
467
383
1886
1358
440
866
448
172
400
308
213
1173
664
698
374
177
375
770
837
2020
276
919
205
551
750
1301
280
988
377
1041
442
692
219
378
484
440
274
343
258
1173
607
302
1240
396
845
260
631
1339
361
617
275
2011
624
833
569
514
459
292
452
442
893
516
67
631
1382
284
1153
246
592
729
440
526
369
484
275
81
185
24
281
57
301
1195
341
332
927
970
1321
749
1101
186
519
1376
229
1763
462
1025
288
344
280
344
970
1970
348
385
1553
466
526
420
521
1426
929
596
310
1236
577
341
866
367
465
1324
1153
1358
480
624
210
448
595
864
1324
212
310
727
292
768
1318
1394
465
467
1022
252
41
476
2058
688
462
577
179
607
177
866
2337
618
100
373
460
498
187
252
1
132
60
25
660
406
568
435
585
466
1066
739
226
929
165
576
1277
642
18
736
670
433
455
1712
1507
790
555
9
1141
493
413
624
332
435
257
493
464
498
2281
240
232
736
27
228
586
55
219
1028
493
1218
310
1896
27
1179
252
1993
132

JOJ Answer

-10
181
45
-57
205
349
5
909
175
4
292
229
-48
1324
-6
319
10
169
1084
1358
-17
801
154
172
-57
308
213
1173
-25
698
-83
45
375
340
275
1817
276
846
205
551
750
1301
280
988
-80
1041
-120
692
219
378
244
-17
274
343
47
1173
607
104
1240
379
845
260
-37
777
361
-40
-10
2011
-22
373
112
514
135
292
452
-120
167
111
-18
-37
1382
192
867
-114
232
405
-17
328
-19
244
-10
81
185
-68
281
-183
301
1195
-116
332
927
110
759
61
1101
-67
519
1376
229
1763
5
-65
288
212
280
344
110
1772
348
171
1259
152
434
420
-64
1426
-48
139
24
779
218
-116
801
45
106
1324
867
1358
480
232
210
154
595
864
1324
212
24
405
292
311
1318
1108
106
234
1022
252
41
88
1698
126
5
577
179
607
85
801
2337
618
-111
373
-102
498
-173
252
1
132
-32
-215
98
-51
6
435
128
466
93
739
226
-48
-46
162
1088
642
18
279
108
74
455
861
1181
88
555
9
896
493
413
232
121
76
257
493
7
184
1719
240
-20
279
27
30
24
55
219
1028
-69
761
24
1656
-65
857
252
1832
132