QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425296#8726. Magic ShowAnosVoldigoad100 ✓1ms2016kbC++143.5kb2024-05-30 07:52:352024-05-30 07:52:35

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms = 0ms + 1ms
memory: 1868kb,2012kb

input:

1
4005

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
4 5
3 6
1 7
5 8
8 9
5 10
1 11
9 12
1 13
1 14
14 15
5 16
10 17
9 18
15 19
5 20
15 21
1 22
3 23
21 24
5 25
1 26
9 27
1 28
3 29
15 30
6 31
5 32
12 33
27 34...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
4 5
3 6
1 7
5 8
8 9
5 10
1 11
9 12
1 13
1 14
14 15
5 16
10 17
9 18
15 19
5 20
15 21
1 22
3 23
21 24
5 25
1 26
9 27
1 28
3 29
15 30
6 31
5 32
12 33
27 34...

output:

2
5000 4430
1 2
1 4
1 11
1 13
1 14
1 22
1 26
1 28
1 44
1 52
1 77
1 91
1 143
1 154
1 308
1 364
1 572
1 1001
1 2002
1 4004
2 3
2 4003
3 6
3 23
3 29
3 46
3 58
3 87
3 138
3 174
3 667
3 1334
3 2001
3 4002
4 5
4 4001
5 8
5 10
5 16
5 20
5 25
5 40
5 80
5 100
5 125
5 160
5 250
5 400
5 500
5 800
5 1000
5 2000...

input:

2
5000 4430
1 2
1 4
1 11
1 13
1 14
1 22
1 26
1 28
1 44
1 52
1 77
1 91
1 143
1 154
1 308
1 364
1 572
1 1001
1 2002
1 4004
2 3
2 4003
3 6
3 23
3 29
3 46
3 58
3 87
3 138
3 174
3 667
3 1334
3 2001
3 4002
4 5
4 4001
5 8
5 10
5 16
5 20
5 25
5 40
5 80
5 100
5 125
5 160
5 250
5 400
5 500
5 800
5 1000
5 2000...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,2016kb

input:

1
459

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
3 6
4 7
3 8
8 9
9 10
8 11
3 12
4 13
11 14
9 15
11 16
16 17
9 18
3 19
19 20
18 21
19 22
22 23
3 24
9 25
17 26
26 27
11 28
24 29
9 30
25 31
11 32
30 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
3 6
4 7
3 8
8 9
9 10
8 11
3 12
4 13
11 14
9 15
11 16
16 17
9 18
3 19
19 20
18 21
19 22
22 23
3 24
9 25
17 26
26 27
11 28
24 29
9 30
25 31
11 32
30 3...

output:

2
5000 4430
1 2
1 229
1 458
2 3
2 457
3 4
3 6
3 8
3 12
3 19
3 24
3 38
3 57
3 76
3 152
3 228
3 456
4 5
4 13
4 35
4 65
4 91
4 455
5 227
5 454
6 151
6 453
7 113
7 452
8 9
8 11
8 41
8 451
9 10
9 15
9 18
9 25
9 45
9 75
9 90
9 150
9 225
9 450
10 449
11 14
11 16
11 28
11 56
11 64
11 112
11 224
11 448
12 14...

input:

2
5000 4430
1 2
1 229
1 458
2 3
2 457
3 4
3 6
3 8
3 12
3 19
3 24
3 38
3 57
3 76
3 152
3 228
3 456
4 5
4 13
4 35
4 65
4 91
4 455
5 227
5 454
6 151
6 453
7 113
7 452
8 9
8 11
8 41
8 451
9 10
9 15
9 18
9 25
9 45
9 75
9 90
9 150
9 225
9 450
10 449
11 14
11 16
11 28
11 56
11 64
11 112
11 224
11 448
12 14...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 1ms = 0ms + 1ms
memory: 1868kb,2016kb

input:

1
2495

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
5 6
3 7
7 8
2 9
5 10
9 11
11 12
12 13
3 14
5 15
15 16
13 17
11 18
6 19
15 20
17 21
9 22
11 23
23 24
20 25
25 26
11 27
3 28
1 29
5 30
15 31
31 32
20 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
5 6
3 7
7 8
2 9
5 10
9 11
11 12
12 13
3 14
5 15
15 16
13 17
11 18
6 19
15 20
17 21
9 22
11 23
23 24
20 25
25 26
11 27
3 28
1 29
5 30
15 31
31 32
20 ...

output:

2
5000 4430
1 2
1 29
1 43
1 58
1 86
1 1247
1 2494
2 3
2 9
2 277
2 2493
3 4
3 14
3 28
3 89
3 178
3 356
3 623
3 1246
4 5
4 47
4 2491
5 6
5 10
5 15
5 83
5 166
5 249
5 498
5 830
5 1245
5 2490
6 19
6 131
6 2489
7 8
7 622
7 1244
7 2488
8 829
8 2487
9 11
9 22
9 113
9 1243
9 2486
10 35
10 355
10 497
10 2485...

input:

2
5000 4430
1 2
1 29
1 43
1 58
1 86
1 1247
1 2494
2 3
2 9
2 277
2 2493
3 4
3 14
3 28
3 89
3 178
3 356
3 623
3 1246
4 5
4 47
4 2491
5 6
5 10
5 15
5 83
5 166
5 249
5 498
5 830
5 1245
5 2490
6 19
6 131
6 2489
7 8
7 622
7 1244
7 2488
8 829
8 2487
9 11
9 22
9 113
9 1243
9 2486
10 35
10 355
10 497
10 2485...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1908kb

input:

3
1560

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
3 9
9 10
9 11
11 12
12 13
6 14
14 15
8 16
13 17
12 18
2 19
19 20
6 21
20 22
19 23
23 24
10 25
25 26
21 27
20 28
23 29
29 30
10 31
24 32
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
3 9
9 10
9 11
11 12
12 13
6 14
14 15
8 16
13 17
12 18
2 19
19 20
6 21
20 22
19 23
23 24
10 25
25 26
21 27
20 28
23 29
29 30
10 31
24 32
...

output:

4
5000 3439
1559 1560
1560 1561
1560 1562
1560 1563
1560 1564
1560 1565
1560 1566
1560 1567
1560 1568
1560 1569
1560 1570
1560 1571
1560 1572
1560 1573
1560 1574
1560 1575
1560 1576
1560 1577
1560 1578
1560 1579
1560 1580
1560 1581
1560 1582
1560 1583
1560 1584
1560 1585
1560 1586
1560 1587
1560 158...

input:

4
5000 3439
1559 1560
1560 1561
1560 1562
1560 1563
1560 1564
1560 1565
1560 1566
1560 1567
1560 1568
1560 1569
1560 1570
1560 1571
1560 1572
1560 1573
1560 1574
1560 1575
1560 1576
1560 1577
1560 1578
1560 1579
1560 1580
1560 1581
1560 1582
1560 1583
1560 1584
1560 1585
1560 1586
1560 1587
1560 158...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

3
3594

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
2 4
4 5
5 6
3 7
2 8
3 9
4 10
8 11
6 12
6 13
10 14
9 15
10 16
7 17
12 18
3 19
14 20
3 21
8 22
6 23
18 24
19 25
6 26
3 27
10 28
27 29
24 30
29 31
10 32
30 33
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
2 4
4 5
5 6
3 7
2 8
3 9
4 10
8 11
6 12
6 13
10 14
9 15
10 16
7 17
12 18
3 19
14 20
3 21
8 22
6 23
18 24
19 25
6 26
3 27
10 28
27 29
24 30
29 31
10 32
30 33
...

output:

4
5000 2500
1 3593
11 3583
13 3581
23 3571
35 3559
37 3557
47 3547
53 3541
55 3539
61 3533
65 3529
67 3527
77 3517
83 3511
95 3499
103 3491
113 3481
125 3469
127 3467
131 3463
133 3461
137 3457
145 3449
161 3433
163 3431
167 3427
181 3413
187 3407
191 3403
193 3401
197 3397
203 3391
205 3389
211 338...

input:

4
5000 2500
1 3593
11 3583
13 3581
23 3571
35 3559
37 3557
47 3547
53 3541
55 3539
61 3533
65 3529
67 3527
77 3517
83 3511
95 3499
103 3491
113 3481
125 3469
127 3467
131 3463
133 3461
137 3457
145 3449
161 3433
163 3431
167 3427
181 3413
187 3407
191 3403
193 3401
197 3397
203 3391
205 3389
211 338...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1908kb

input:

3
1750

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
2 4
4 5
4 6
6 7
6 8
4 9
9 10
1 11
10 12
8 13
13 14
10 15
6 16
16 17
4 18
2 19
10 20
7 21
12 22
2 23
22 24
24 25
8 26
22 27
14 28
10 29
10 30
14 31
22 32
1 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
2 4
4 5
4 6
6 7
6 8
4 9
9 10
1 11
10 12
8 13
13 14
10 15
6 16
16 17
4 18
2 19
10 20
7 21
12 22
2 23
22 24
24 25
8 26
22 27
14 28
10 29
10 30
14 31
22 32
1 3...

output:

4
5000 3249
1749 1750
1750 1751
1750 1752
1750 1753
1750 1754
1750 1755
1750 1756
1750 1757
1750 1758
1750 1759
1750 1760
1750 1761
1750 1762
1750 1763
1750 1764
1750 1765
1750 1766
1750 1767
1750 1768
1750 1769
1750 1770
1750 1771
1750 1772
1750 1773
1750 1774
1750 1775
1750 1776
1750 1777
1750 177...

input:

4
5000 3249
1749 1750
1750 1751
1750 1752
1750 1753
1750 1754
1750 1755
1750 1756
1750 1757
1750 1758
1750 1759
1750 1760
1750 1761
1750 1762
1750 1763
1750 1764
1750 1765
1750 1766
1750 1767
1750 1768
1750 1769
1750 1770
1750 1771
1750 1772
1750 1773
1750 1774
1750 1775
1750 1776
1750 1777
1750 177...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1900kb

input:

5
4878

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
2 4
3 5
5 6
6 7
6 8
8 9
8 10
5 11
6 12
3 13
6 14
3 15
14 16
16 17
17 18
14 19
18 20
6 21
16 22
2 23
6 24
3 25
16 26
18 27
6 28
6 29
18 30
11 31
14 32
27 33
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
2 4
3 5
5 6
6 7
6 8
8 9
8 10
5 11
6 12
3 13
6 14
3 15
14 16
16 17
17 18
14 19
18 20
6 21
16 22
2 23
6 24
3 25
16 26
18 27
6 28
6 29
18 30
11 31
14 32
27 33
...

output:

6
5000 2560
1 4877
2 2438
3 5
3 13
3 15
3 25
3 39
3 65
3 75
3 125
3 195
3 325
3 375
3 975
3 1625
3 4875
4 2437
4 4874
6 7
6 8
6 12
6 14
6 21
6 24
6 28
6 29
6 42
6 56
6 58
6 84
6 87
6 116
6 168
6 174
6 203
6 232
6 348
6 406
6 609
6 696
6 812
6 1218
6 1624
6 2436
6 4872
9 541
9 1623
9 4869
10 1217
10 ...

input:

6
5000 2560
1 4877
2 2438
3 5
3 13
3 15
3 25
3 39
3 65
3 75
3 125
3 195
3 325
3 375
3 975
3 1625
3 4875
4 2437
4 4874
6 7
6 8
6 12
6 14
6 21
6 24
6 28
6 29
6 42
6 56
6 58
6 84
6 87
6 116
6 168
6 174
6 203
6 232
6 348
6 406
6 609
6 696
6 812
6 1218
6 1624
6 2436
6 4872
9 541
9 1623
9 4869
10 1217
10 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 1ms = 0ms + 1ms
memory: 1864kb,2012kb

input:

5
1223

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
3 5
5 6
5 7
7 8
8 9
3 10
2 11
11 12
1 13
5 14
8 15
7 16
16 17
17 18
7 19
3 20
5 21
13 22
4 23
23 24
23 25
1 26
8 27
19 28
5 29
23 30
14 31
7 32
2 33
33 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
3 5
5 6
5 7
7 8
8 9
3 10
2 11
11 12
1 13
5 14
8 15
7 16
16 17
17 18
7 19
3 20
5 21
13 22
4 23
23 24
23 25
1 26
8 27
19 28
5 29
23 30
14 31
7 32
2 33
33 ...

output:

6
5000 4388
1 2
1 13
1 26
1 47
1 94
1 1222
3 4
3 5
3 10
3 20
3 61
3 122
3 244
3 305
3 610
3 1220
6 1217
7 8
7 16
7 19
7 32
7 38
7 64
7 76
7 152
7 304
7 608
7 1216
9 607
9 1214
11 12
11 101
11 202
11 303
11 404
11 606
11 1212
14 31
14 39
14 93
14 403
14 1209
15 151
15 302
15 604
15 1208
17 18
17 67
1...

input:

6
5000 4388
1 2
1 13
1 26
1 47
1 94
1 1222
3 4
3 5
3 10
3 20
3 61
3 122
3 244
3 305
3 610
3 1220
6 1217
7 8
7 16
7 19
7 32
7 38
7 64
7 76
7 152
7 304
7 608
7 1216
9 607
9 1214
11 12
11 101
11 202
11 303
11 404
11 606
11 1212
14 31
14 39
14 93
14 403
14 1209
15 151
15 302
15 604
15 1208
17 18
17 67
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 1ms = 0ms + 1ms
memory: 1864kb,2012kb

input:

5
648

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
3 5
5 6
4 7
7 8
8 9
8 10
10 11
11 12
11 13
4 14
3 15
8 16
2 17
17 18
2 19
8 20
18 21
10 22
4 23
23 24
23 25
24 26
26 27
4 28
10 29
18 30
28 31
8 32
21 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
3 5
5 6
4 7
7 8
8 9
8 10
10 11
11 12
11 13
4 14
3 15
8 16
2 17
17 18
2 19
8 20
18 21
10 22
4 23
23 24
23 25
24 26
26 27
4 28
10 29
18 30
28 31
8 32
21 3...

output:

6
5000 4675
1 647
2 323
3 4
3 5
3 15
3 43
3 129
3 215
3 645
6 107
6 214
6 321
6 642
7 8
7 641
9 71
9 213
9 639
10 11
10 22
10 29
10 58
10 319
10 638
12 53
12 106
12 159
12 212
12 318
12 636
13 127
13 635
14 317
14 634
16 79
16 158
16 316
16 632
17 18
17 631
19 37
19 629
20 157
20 314
20 628
21 33
21...

input:

6
5000 4675
1 647
2 323
3 4
3 5
3 15
3 43
3 129
3 215
3 645
6 107
6 214
6 321
6 642
7 8
7 641
9 71
9 213
9 639
10 11
10 22
10 29
10 58
10 319
10 638
12 53
12 106
12 159
12 212
12 318
12 636
13 127
13 635
14 317
14 634
16 79
16 158
16 316
16 632
17 18
17 631
19 37
19 629
20 157
20 314
20 628
21 33
21...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1892kb

input:

7
4475

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
3 4
4 5
5 6
2 7
3 8
2 9
5 10
9 11
11 12
3 13
9 14
5 15
11 16
4 17
11 18
10 19
15 20
2 21
9 22
13 23
11 24
24 25
3 26
20 27
23 28
9 29
5 30
11 31
27 32
20 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
3 4
4 5
5 6
2 7
3 8
2 9
5 10
9 11
11 12
3 13
9 14
5 15
11 16
4 17
11 18
10 19
15 20
2 21
9 22
13 23
11 24
24 25
3 26
20 27
23 28
9 29
5 30
11 31
27 32
20 33...

output:

8
5000 2500
1 4474
8 4467
12 4463
14 4461
18 4457
24 4451
26 4449
28 4447
32 4443
33 4442
34 4441
36 4439
40 4435
46 4429
48 4427
49 2213
49 4426
52 4423
54 4421
58 4417
60 4415
61 2207
61 4414
62 4413
64 4411
66 4409
69 4406
70 4405
76 4399
78 4397
82 4393
84 4391
88 4387
90 4385
94 4381
96 4379
98...

input:

8
5000 2500
1 4474
8 4467
12 4463
14 4461
18 4457
24 4451
26 4449
28 4447
32 4443
33 4442
34 4441
36 4439
40 4435
46 4429
48 4427
49 2213
49 4426
52 4423
54 4421
58 4417
60 4415
61 2207
61 4414
62 4413
64 4411
66 4409
69 4406
70 4405
76 4399
78 4397
82 4393
84 4391
88 4387
90 4385
94 4381
96 4379
98...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1892kb

input:

7
4240

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
4 5
4 6
5 7
7 8
1 9
9 10
5 11
4 12
2 13
12 14
10 15
15 16
7 17
10 18
3 19
19 20
19 21
16 22
8 23
16 24
15 25
2 26
1 27
12 28
6 29
10 30
24 31
16 32
16 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
4 5
4 6
5 7
7 8
1 9
9 10
5 11
4 12
2 13
12 14
10 15
15 16
7 17
10 18
3 19
19 20
19 21
16 22
8 23
16 24
15 25
2 26
1 27
12 28
6 29
10 30
24 31
16 32
16 3...

output:

8
5000 2500
9 4231
11 4229
13 4227
14 4226
18 4222
21 4219
23 4217
27 4213
29 4211
33 4207
39 4201
42 4198
43 4197
45 4195
47 599
47 4193
53 4187
57 4183
59 4181
62 2089
62 4178
63 4177
66 4174
69 4171
71 4169
74 4166
77 4163
78 4162
81 4159
83 4157
87 4153
89 4151
95 4145
97 1381
97 4143
99 4141
10...

input:

8
5000 2500
9 4231
11 4229
13 4227
14 4226
18 4222
21 4219
23 4217
27 4213
29 4211
33 4207
39 4201
42 4198
43 4197
45 4195
47 599
47 4193
53 4187
57 4183
59 4181
62 2089
62 4178
63 4177
66 4174
69 4171
71 4169
74 4166
77 4163
78 4162
81 4159
83 4157
87 4153
89 4151
95 4145
97 1381
97 4143
99 4141
10...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

7
1291

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
1 5
1 6
3 7
3 8
4 9
1 10
4 11
7 12
4 13
3 14
1 15
11 16
16 17
13 18
18 19
11 20
10 21
15 22
3 23
19 24
16 25
17 26
22 27
3 28
15 29
1 30
20 31
11 32
4 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
1 5
1 6
3 7
3 8
4 9
1 10
4 11
7 12
4 13
3 14
1 15
11 16
16 17
13 18
18 19
11 20
10 21
15 22
3 23
19 24
16 25
17 26
22 27
3 28
15 29
1 30
20 31
11 32
4 3...

output:

8
5000 2500
1291 1292
1291 1293
1291 1296
1291 1297
1291 1298
1291 1302
1291 1303
1291 1304
1291 1305
1291 1306
1291 1307
1291 1308
1291 1309
1291 1310
1291 1311
1291 1312
1291 1313
1291 1314
1291 1315
1291 1316
1291 1319
1291 1322
1291 1325
1291 1327
1291 1330
1291 1331
1291 1332
1291 1333
1291 133...

input:

8
5000 2500
1291 1292
1291 1293
1291 1296
1291 1297
1291 1298
1291 1302
1291 1303
1291 1304
1291 1305
1291 1306
1291 1307
1291 1308
1291 1309
1291 1310
1291 1311
1291 1312
1291 1313
1291 1314
1291 1315
1291 1316
1291 1319
1291 1322
1291 1325
1291 1327
1291 1330
1291 1331
1291 1332
1291 1333
1291 133...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,2016kb

input:

1
17476204

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
3 4
4 5
4 6
4 7
4 8
4 9
4 10
9 11
4 12
5 13
4 14
4 15
12 16
16 17
4 18
4 19
4 20
4 21
20 22
22 23
4 24
4 25
18 26
22 27
4 28
21 29
4 30
16 31
12 32
31 33
33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
3 4
4 5
4 6
4 7
4 8
4 9
4 10
9 11
4 12
5 13
4 14
4 15
12 16
16 17
4 18
4 19
4 20
4 21
20 22
22 23
4 24
4 25
18 26
22 27
4 28
21 29
4 30
16 31
12 32
31 33
33...

output:

2
5000 4430
1 2
1 3
1 321
3 4
3 1187
4 5
4 6
4 8
4 9
4 10
4 12
4 14
4 15
4 18
4 19
4 20
4 21
4 24
4 25
4 28
4 35
4 36
4 38
4 40
4 45
4 56
4 57
4 60
4 63
4 70
4 72
4 73
4 75
4 76
4 84
4 90
4 95
4 100
4 105
4 120
4 126
4 133
4 140
4 150
4 152
4 168
4 171
4 175
4 180
4 190
4 210
4 219
4 225
4 228
4 252...

input:

2
5000 4430
1 2
1 3
1 321
3 4
3 1187
4 5
4 6
4 8
4 9
4 10
4 12
4 14
4 15
4 18
4 19
4 20
4 21
4 24
4 25
4 28
4 35
4 36
4 38
4 40
4 45
4 56
4 57
4 60
4 63
4 70
4 72
4 73
4 75
4 76
4 84
4 90
4 95
4 100
4 105
4 120
4 126
4 133
4 140
4 150
4 152
4 168
4 171
4 175
4 180
4 190
4 210
4 219
4 225
4 228
4 252...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,2012kb

input:

1
11926600

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
3 4
4 5
4 6
6 7
7 8
7 9
9 10
4 11
4 12
10 13
13 14
10 15
8 16
12 17
16 18
15 19
19 20
7 21
4 22
19 23
16 24
24 25
10 26
25 27
27 28
2 29
10 30
1 31
8 32
4 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
3 4
4 5
4 6
6 7
7 8
7 9
9 10
4 11
4 12
10 13
13 14
10 15
8 16
12 17
16 18
15 19
19 20
7 21
4 22
19 23
16 24
24 25
10 26
25 27
27 28
2 29
10 30
1 31
8 32
4 3...

output:

2
5000 4430
1 2
1 3
1 31
1 93
1 257
1 499
1 1497
2 29
2 58
2 61
2 122
2 1769
2 3371
2 3538
3 4
3 2137
4 5
4 6
4 11
4 12
4 22
4 33
4 44
4 66
4 132
6 73
7 8
7 9
7 21
7 63
8 16
8 64
8 331
8 563
8 662
8 1126
9 10
9 179
10 13
10 15
10 26
10 39
10 65
10 78
10 106
10 130
10 159
10 195
10 265
10 390
10 530
...

input:

2
5000 4430
1 2
1 3
1 31
1 93
1 257
1 499
1 1497
2 29
2 58
2 61
2 122
2 1769
2 3371
2 3538
3 4
3 2137
4 5
4 6
4 11
4 12
4 22
4 33
4 44
4 66
4 132
6 73
7 8
7 9
7 21
7 63
8 16
8 64
8 331
8 563
8 662
8 1126
9 10
9 179
10 13
10 15
10 26
10 39
10 65
10 78
10 106
10 130
10 159
10 195
10 265
10 390
10 530
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1864kb,2016kb

input:

1
16602378

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
2 4
3 5
5 6
2 7
2 8
6 9
8 10
1 11
6 12
12 13
2 14
3 15
10 16
8 17
6 18
7 19
18 20
9 21
12 22
12 23
18 24
3 25
25 26
24 27
2 28
23 29
18 30
18 31
10 32
12 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
2 4
3 5
5 6
2 7
2 8
6 9
8 10
1 11
6 12
12 13
2 14
3 15
10 16
8 17
6 18
7 19
18 20
9 21
12 22
12 23
18 24
3 25
25 26
24 27
2 28
23 29
18 30
18 31
10 32
12 33...

output:

2
5000 4430
1 2
1 11
2 3
2 4
2 8
2 14
2 28
2 41
2 49
2 56
2 82
2 98
2 196
2 287
2 328
2 392
2 574
2 1033
2 1148
2 2009
2 2066
2 2296
2 4018
2 4132
3 5
3 15
3 25
3 75
3 125
3 375
4 47
4 94
4 239
4 478
4 739
5 6
6 9
6 12
6 18
6 36
6 197
6 394
6 591
6 788
6 1182
6 1773
6 2341
6 2364
6 3546
6 4682
7 19
...

input:

2
5000 4430
1 2
1 11
2 3
2 4
2 8
2 14
2 28
2 41
2 49
2 56
2 82
2 98
2 196
2 287
2 328
2 392
2 574
2 1033
2 1148
2 2009
2 2066
2 2296
2 4018
2 4132
3 5
3 15
3 25
3 75
3 125
3 375
4 47
4 94
4 239
4 478
4 739
5 6
6 9
6 12
6 18
6 36
6 197
6 394
6 591
6 788
6 1182
6 1773
6 2341
6 2364
6 3546
6 4682
7 19
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1892kb

input:

3
13129243

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
3 4
3 5
1 6
1 7
3 8
7 9
3 10
6 11
7 12
10 13
1 14
13 15
11 16
7 17
7 18
15 19
3 20
1 21
17 22
15 23
19 24
18 25
23 26
7 27
15 28
15 29
13 30
30 31
27 32
28 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
3 4
3 5
1 6
1 7
3 8
7 9
3 10
6 11
7 12
10 13
1 14
13 15
11 16
7 17
7 18
15 19
3 20
1 21
17 22
15 23
19 24
18 25
23 26
7 27
15 28
15 29
13 30
30 31
27 32
28 ...

output:

4
5000 2500
5 467
5 934
6 11
8 35
9 1226
10 43
11 16
16 373
16 1119
16 3357
16 3911
18 41
18 1025
20 263
22 107
22 321
22 749
22 2247
23 26
23 65
23 130
23 260
24 2729
24 4811
27 32
27 64
27 128
27 256
27 512
32 59
32 1153
35 947
35 1733
35 1894
35 3466
35 3788
36 49
36 637
37 167
37 334
37 501
37 1...

input:

4
5000 2500
5 467
5 934
6 11
8 35
9 1226
10 43
11 16
16 373
16 1119
16 3357
16 3911
18 41
18 1025
20 263
22 107
22 321
22 749
22 2247
23 26
23 65
23 130
23 260
24 2729
24 4811
27 32
27 64
27 128
27 256
27 512
32 59
32 1153
35 947
35 1733
35 1894
35 3466
35 3788
36 49
36 637
37 167
37 334
37 501
37 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

3
7892141

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
1 5
5 6
5 7
5 8
5 9
1 10
4 11
5 12
10 13
5 14
11 15
13 16
10 17
5 18
16 19
1 20
5 21
15 22
13 23
5 24
16 25
23 26
14 27
5 28
23 29
11 30
6 31
13 32
26 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
1 5
5 6
5 7
5 8
5 9
1 10
4 11
5 12
10 13
5 14
11 15
13 16
10 17
5 18
16 19
1 20
5 21
15 22
13 23
5 24
16 25
23 26
14 27
5 28
23 29
11 30
6 31
13 32
26 3...

output:

4
5000 2500
2 3
3 83
3 166
4 11
4 407
8 557
8 1671
8 4723
10 41
11 15
11 30
15 22
18 877
24 2713
24 2909
25 547
25 1094
25 2188
25 3607
28 857
29 48
31 358
31 895
31 1790
31 4409
32 227
32 2043
32 3863
36 115
36 1495
38 73
38 219
41 45
41 50
41 54
41 60
41 74
41 75
41 79
41 90
41 100
41 108
41 111
4...

input:

4
5000 2500
2 3
3 83
3 166
4 11
4 407
8 557
8 1671
8 4723
10 41
11 15
11 30
15 22
18 877
24 2713
24 2909
25 547
25 1094
25 2188
25 3607
28 857
29 48
31 358
31 895
31 1790
31 4409
32 227
32 2043
32 3863
36 115
36 1495
38 73
38 219
41 45
41 50
41 54
41 60
41 74
41 75
41 79
41 90
41 100
41 108
41 111
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1896kb

input:

3
21314775

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
4 5
3 6
6 7
7 8
3 9
5 10
9 11
3 12
1 13
13 14
14 15
7 16
5 17
3 18
5 19
15 20
6 21
9 22
8 23
15 24
24 25
1 26
3 27
27 28
7 29
15 30
12 31
23 32
9 33
5 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
4 5
3 6
6 7
7 8
3 9
5 10
9 11
3 12
1 13
13 14
14 15
7 16
5 17
3 18
5 19
15 20
6 21
9 22
8 23
15 24
24 25
1 26
3 27
27 28
7 29
15 30
12 31
23 32
9 33
5 3...

output:

4
5000 2500
1 2
1 13
1 26
8 439
8 2111
9 11
9 33
9 66
10 1231
10 3463
11 853
11 1706
11 3412
13 14
16 73
19 86
19 172
24 25
24 57
25 50
25 125
25 250
28 1237
33 61
33 122
33 366
34 1267
36 37
37 74
37 113
37 226
37 2549
37 4181
38 101
38 239
38 883
40 47
40 611
40 3055
41 137
41 274
41 959
41 1918
5...

input:

4
5000 2500
1 2
1 13
1 26
8 439
8 2111
9 11
9 33
9 66
10 1231
10 3463
11 853
11 1706
11 3412
13 14
16 73
19 86
19 172
24 25
24 57
25 50
25 125
25 250
28 1237
33 61
33 122
33 366
34 1267
36 37
37 74
37 113
37 226
37 2549
37 4181
38 101
38 239
38 883
40 47
40 611
40 3055
41 137
41 274
41 959
41 1918
5...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1900kb

input:

5
5559540

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
6 7
4 8
6 9
9 10
8 11
11 12
12 13
13 14
14 15
4 16
13 17
6 18
7 19
19 20
20 21
8 22
3 23
12 24
15 25
12 26
24 27
27 28
8 29
29 30
30 31
20 32
30...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
6 7
4 8
6 9
9 10
8 11
11 12
12 13
13 14
14 15
4 16
13 17
6 18
7 19
19 20
20 21
8 22
3 23
12 24
15 25
12 26
24 27
27 28
8 29
29 30
30 31
20 32
30...

output:

6
5000 2503
1 2333
1 2383
2 3
3 23
3 69
3 197
3 409
3 591
3 1227
3 4531
4 5
5 283
5 1415
5 3929
6 9
7 19
7 133
8 11
8 22
8 29
8 44
8 58
8 116
8 319
8 638
8 1276
8 4357
12 13
12 24
12 26
12 39
12 52
12 78
12 103
12 104
12 156
12 173
12 206
12 309
12 312
12 346
12 412
12 519
12 618
12 692
12 824
12 10...

input:

6
5000 2503
1 2333
1 2383
2 3
3 23
3 69
3 197
3 409
3 591
3 1227
3 4531
4 5
5 283
5 1415
5 3929
6 9
7 19
7 133
8 11
8 22
8 29
8 44
8 58
8 116
8 319
8 638
8 1276
8 4357
12 13
12 24
12 26
12 39
12 52
12 78
12 103
12 104
12 156
12 173
12 206
12 309
12 312
12 346
12 412
12 519
12 618
12 692
12 824
12 10...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1892kb

input:

5
9424319

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
2 7
7 8
5 9
9 10
3 11
11 12
8 13
9 14
14 15
15 16
12 17
5 18
15 19
19 20
2 21
3 22
22 23
23 24
19 25
21 26
23 27
23 28
15 29
29 30
9 31
31 32
14...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
2 7
7 8
5 9
9 10
3 11
11 12
8 13
9 14
14 15
15 16
12 17
5 18
15 19
19 20
2 21
3 22
22 23
23 24
19 25
21 26
23 27
23 28
15 29
29 30
9 31
31 32
14...

output:

6
5000 2642
1 83
1 166
2 3
3 11
3 22
3 44
4 5
5 6
5 18
7 8
9 10
12 17
12 37
12 629
13 59
13 118
14 15
14 33
14 45
14 55
14 79
14 99
14 165
14 237
14 241
14 395
14 495
14 711
14 723
14 869
14 1185
14 1205
14 2169
14 2607
14 2651
14 3555
14 3615
14 4345
16 389
16 2723
16 3461
19 20
19 25
19 50
19 73
1...

input:

6
5000 2642
1 83
1 166
2 3
3 11
3 22
3 44
4 5
5 6
5 18
7 8
9 10
12 17
12 37
12 629
13 59
13 118
14 15
14 33
14 45
14 55
14 79
14 99
14 165
14 237
14 241
14 395
14 495
14 711
14 723
14 869
14 1185
14 1205
14 2169
14 2607
14 2651
14 3555
14 3615
14 4345
16 389
16 2723
16 3461
19 20
19 25
19 50
19 73
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

5
10955780

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
2 6
3 7
4 8
8 9
9 10
10 11
8 12
4 13
10 14
5 15
4 16
11 17
8 18
18 19
19 20
17 21
21 22
6 23
20 24
5 25
4 26
17 27
24 28
15 29
20 30
8 31
4 32
11 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
2 6
3 7
4 8
8 9
9 10
10 11
8 12
4 13
10 14
5 15
4 16
11 17
8 18
18 19
19 20
17 21
21 22
6 23
20 24
5 25
4 26
17 27
24 28
15 29
20 30
8 31
4 32
11 33...

output:

6
5000 2553
1 2
2 6
3 4
4 5
4 8
4 13
4 26
4 32
4 52
4 64
4 104
4 128
4 208
4 256
4 416
4 512
4 823
4 832
4 1024
4 1646
4 1664
4 3292
4 3328
7 67
7 101
7 1619
9 10
9 2477
9 4423
11 17
11 33
11 51
11 59
11 177
11 187
11 331
11 561
11 649
11 993
11 1003
11 1947
11 3009
11 3641
12 587
12 1174
12 2333
12...

input:

6
5000 2553
1 2
2 6
3 4
4 5
4 8
4 13
4 26
4 32
4 52
4 64
4 104
4 128
4 208
4 256
4 416
4 512
4 823
4 832
4 1024
4 1646
4 1664
4 3292
4 3328
7 67
7 101
7 1619
9 10
9 2477
9 4423
11 17
11 33
11 51
11 59
11 177
11 187
11 331
11 561
11 649
11 993
11 1003
11 1947
11 3009
11 3641
12 587
12 1174
12 2333
12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1900kb

input:

7
19938721

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
1 4
1 5
1 6
5 7
1 8
4 9
1 10
10 11
1 12
10 13
5 14
1 15
1 16
16 17
13 18
7 19
1 20
19 21
11 22
21 23
1 24
21 25
23 26
4 27
5 28
3 29
1 30
17 31
1 32
22 33
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
1 4
1 5
1 6
5 7
1 8
4 9
1 10
10 11
1 12
10 13
5 14
1 15
1 16
16 17
13 18
7 19
1 20
19 21
11 22
21 23
1 24
21 25
23 26
4 27
5 28
3 29
1 30
17 31
1 32
22 33
3...

output:

8
5000 2500
3 29
3 58
4 9
4 81
4 1917
4 3467
6 373
6 1865
7 38
8 43
8 4343
8 4591
12 73
13 37
13 74
13 111
13 333
13 1332
15 53
15 106
15 1373
15 2746
16 255
19 42
19 727
19 1306
19 1454
19 1959
19 2181
19 3918
19 4362
19 4571
24 547
25 59
25 118
25 236
25 354
25 708
26 95
26 133
26 665
27 1459
27 2...

input:

8
5000 2500
3 29
3 58
4 9
4 81
4 1917
4 3467
6 373
6 1865
7 38
8 43
8 4343
8 4591
12 73
13 37
13 74
13 111
13 333
13 1332
15 53
15 106
15 1373
15 2746
16 255
19 42
19 727
19 1306
19 1454
19 1959
19 2181
19 3918
19 4362
19 4571
24 547
25 59
25 118
25 236
25 354
25 708
26 95
26 133
26 665
27 1459
27 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1896kb

input:

7
5129508

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
3 4
3 5
5 6
6 7
4 8
3 9
8 10
10 11
11 12
7 13
6 14
3 15
4 16
13 17
12 18
2 19
8 20
6 21
10 22
2 23
12 24
8 25
20 26
21 27
20 28
17 29
18 30
30 31
4 32
21 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
3 4
3 5
5 6
6 7
4 8
3 9
8 10
10 11
11 12
7 13
6 14
3 15
4 16
13 17
12 18
2 19
8 20
6 21
10 22
2 23
12 24
8 25
20 26
21 27
20 28
17 29
18 30
30 31
4 32
21 33...

output:

8
5000 2500
1 331
2 19
2 23
2 437
6 14
8 100
8 500
9 53
9 159
15 563
15 3037
16 797
16 1594
16 1609
17 29
17 73
17 2423
22 94
22 197
25 1909
25 2687
31 337
31 491
33 195
33 975
34 298
34 1043
34 2086
34 2459
34 4918
35 107
36 128
37 1201
37 4271
39 369
41 49
42 71
42 213
44 421
44 842
44 1523
44 304...

input:

8
5000 2500
1 331
2 19
2 23
2 437
6 14
8 100
8 500
9 53
9 159
15 563
15 3037
16 797
16 1594
16 1609
17 29
17 73
17 2423
22 94
22 197
25 1909
25 2687
31 337
31 491
33 195
33 975
34 298
34 1043
34 2086
34 2459
34 4918
35 107
36 128
37 1201
37 4271
39 369
41 49
42 71
42 213
44 421
44 842
44 1523
44 304...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1896kb

input:

7
15332941

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
1 4
1 5
1 6
1 7
5 8
1 9
1 10
8 11
1 12
12 13
1 14
1 15
13 16
12 17
1 18
17 19
1 20
1 21
19 22
14 23
13 24
16 25
13 26
19 27
1 28
3 29
1 30
30 31
13 32
19 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
1 4
1 5
1 6
1 7
5 8
1 9
1 10
8 11
1 12
12 13
1 14
1 15
13 16
12 17
1 18
17 19
1 20
1 21
19 22
14 23
13 24
16 25
13 26
19 27
1 28
3 29
1 30
30 31
13 32
19 33...

output:

8
5000 2500
3 167
3 3166
3 4843
8 11
8 49
14 23
16 25
16 75
17 76
17 458
17 881
17 916
17 3524
20 163
20 863
27 2182
28 331
28 993
28 2979
29 1904
30 101
30 373
30 1111
30 3737
30 4103
31 62
32 271
32 1951
33 1412
34 573
36 95
36 665
38 137
39 482
39 2447
39 4894
48 367
48 1019
51 718
51 1795
51 359...

input:

8
5000 2500
3 167
3 3166
3 4843
8 11
8 49
14 23
16 25
16 75
17 76
17 458
17 881
17 916
17 3524
20 163
20 863
27 2182
28 331
28 993
28 2979
29 1904
30 101
30 373
30 1111
30 3737
30 4103
31 62
32 271
32 1951
33 1412
34 573
36 95
36 665
38 137
39 482
39 2447
39 4894
48 367
48 1019
51 718
51 1795
51 359...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1904kb

input:

1
355365355024496523

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
3 5
3 6
6 7
3 8
3 9
3 10
3 11
3 12
5 13
7 14
3 15
11 16
14 17
3 18
18 19
3 20
20 21
3 22
9 23
3 24
23 25
5 26
12 27
7 28
10 29
3 30
6 31
11 32
3 33
31 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
3 5
3 6
6 7
3 8
3 9
3 10
3 11
3 12
5 13
7 14
3 15
11 16
14 17
3 18
18 19
3 20
20 21
3 22
9 23
3 24
23 25
5 26
12 27
7 28
10 29
3 30
6 31
11 32
3 33
31 3...

output:

2
5000 3132
1 2
2 3
2 257
3 4
3 8
3 9
3 10
3 12
3 15
3 18
3 30
3 33
3 40
3 55
3 60
3 90
3 110
3 120
3 180
3 198
3 220
3 264
3 283
3 396
3 440
3 495
3 792
3 990
3 1132
3 1415
3 1698
3 2264
3 2830
3 4245
5 13
5 26
5 106
5 1378
6 7
6 31
6 93
9 23
9 37
9 74
9 111
9 138
9 222
9 249
9 498
9 851
9 1909
9 2...

input:

2
5000 3132
1 2
2 3
2 257
3 4
3 8
3 9
3 10
3 12
3 15
3 18
3 30
3 33
3 40
3 55
3 60
3 90
3 110
3 120
3 180
3 198
3 220
3 264
3 283
3 396
3 440
3 495
3 792
3 990
3 1132
3 1415
3 1698
3 2264
3 2830
3 4245
5 13
5 26
5 106
5 1378
6 7
6 31
6 93
9 23
9 37
9 74
9 111
9 138
9 222
9 249
9 498
9 851
9 1909
9 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1904kb

input:

1
727827999106414164

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
5 6
6 7
4 8
6 9
4 10
2 11
11 12
10 13
13 14
9 15
4 16
11 17
6 18
13 19
4 20
20 21
2 22
22 23
12 24
14 25
10 26
24 27
27 28
19 29
24 30
23 31
20 32
2...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
5 6
6 7
4 8
6 9
4 10
2 11
11 12
10 13
13 14
9 15
4 16
11 17
6 18
13 19
4 20
20 21
2 22
22 23
12 24
14 25
10 26
24 27
27 28
19 29
24 30
23 31
20 32
2...

output:

2
5000 3132
1 2
2 3
2 121
3 4
4 8
4 10
4 16
4 40
4 80
5 137
6 7
6 9
6 18
9 15
10 13
10 26
10 193
10 386
10 1231
10 2462
10 2509
11 12
11 197
11 289
11 337
11 2371
11 3349
13 19
13 209
14 70
14 113
14 175
14 226
14 565
14 1130
14 1582
14 2825
14 3955
15 239
15 563
15 717
16 1249
16 2498
16 3511
16 49...

input:

2
5000 3132
1 2
2 3
2 121
3 4
4 8
4 10
4 16
4 40
4 80
5 137
6 7
6 9
6 18
9 15
10 13
10 26
10 193
10 386
10 1231
10 2462
10 2509
11 12
11 197
11 289
11 337
11 2371
11 3349
13 19
13 209
14 70
14 113
14 175
14 226
14 565
14 1130
14 1582
14 2825
14 3955
15 239
15 563
15 717
16 1249
16 2498
16 3511
16 49...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1908kb

input:

1
656410143989222955

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
3 6
3 7
3 8
8 9
5 10
2 11
3 12
7 13
3 14
14 15
11 16
1 17
9 18
15 19
15 20
3 21
13 22
9 23
3 24
5 25
7 26
26 27
3 28
20 29
15 30
24 31
11 32
24 33
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
3 6
3 7
3 8
8 9
5 10
2 11
3 12
7 13
3 14
14 15
11 16
1 17
9 18
15 19
15 20
3 21
13 22
9 23
3 24
5 25
7 26
26 27
3 28
20 29
15 30
24 31
11 32
24 33
1...

output:

2
5000 3132
1 2
1 34
1 4483
2 3
3 4
3 7
3 8
3 12
3 42
3 56
3 84
3 4166
4 73
5 10
6 159
6 347
7 13
7 26
7 1583
8 9
8 37
8 41
9 18
9 23
9 138
9 207
9 401
9 414
9 2406
9 3609
11 16
11 32
14 15
14 197
15 19
15 30
15 38
15 57
15 60
15 76
15 114
15 190
15 380
16 257
17 49
17 107
17 214
17 749
17 1043
17 1...

input:

2
5000 3132
1 2
1 34
1 4483
2 3
3 4
3 7
3 8
3 12
3 42
3 56
3 84
3 4166
4 73
5 10
6 159
6 347
7 13
7 26
7 1583
8 9
8 37
8 41
9 18
9 23
9 138
9 207
9 401
9 414
9 2406
9 3609
11 16
11 32
14 15
14 197
15 19
15 30
15 38
15 57
15 60
15 76
15 114
15 190
15 380
16 257
17 49
17 107
17 214
17 749
17 1043
17 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1904kb

input:

1
410366615149657534

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
4 5
4 6
4 7
6 8
4 9
4 10
5 11
10 12
4 13
4 14
4 15
14 16
15 17
4 18
8 19
14 20
4 21
16 22
2 23
22 24
9 25
4 26
4 27
18 28
11 29
4 30
8 31
30 32
16 33
32...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
4 5
4 6
4 7
6 8
4 9
4 10
5 11
10 12
4 13
4 14
4 15
14 16
15 17
4 18
8 19
14 20
4 21
16 22
2 23
22 24
9 25
4 26
4 27
18 28
11 29
4 30
8 31
30 32
16 33
32...

output:

2
5000 3132
1 2
1 3
2 4
2 23
2 71
2 92
2 106
2 142
2 212
2 1219
2 2438
2 3266
2 3763
2 4876
4 7
4 9
4 10
4 13
4 15
4 18
4 26
4 30
4 42
4 54
4 63
4 65
4 70
4 78
4 90
4 91
4 135
4 189
4 210
4 234
4 270
4 351
4 378
4 390
4 455
4 585
4 630
4 945
4 1170
4 1638
4 1755
4 1890
4 2457
4 2730
4 3510
4 4095
4 ...

input:

2
5000 3132
1 2
1 3
2 4
2 23
2 71
2 92
2 106
2 142
2 212
2 1219
2 2438
2 3266
2 3763
2 4876
4 7
4 9
4 10
4 13
4 15
4 18
4 26
4 30
4 42
4 54
4 63
4 65
4 70
4 78
4 90
4 91
4 135
4 189
4 210
4 234
4 270
4 351
4 378
4 390
4 455
4 585
4 630
4 945
4 1170
4 1638
4 1755
4 1890
4 2457
4 2730
4 3510
4 4095
4 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1900kb

input:

1
298090682780948428

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
3 4
3 5
4 6
6 7
4 8
4 9
8 10
8 11
4 12
7 13
13 14
13 15
12 16
14 17
4 18
11 19
8 20
7 21
8 22
4 23
4 24
3 25
20 26
13 27
27 28
22 29
28 30
30 31
12 32
19 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
3 4
3 5
4 6
6 7
4 8
4 9
8 10
8 11
4 12
7 13
13 14
13 15
12 16
14 17
4 18
11 19
8 20
7 21
8 22
4 23
4 24
3 25
20 26
13 27
27 28
22 29
28 30
30 31
12 32
19 33...

output:

2
5000 3132
1 2
1 3
1 3513
3 4
4 8
4 9
4 12
4 18
4 23
4 92
4 138
4 207
4 414
4 552
4 828
4 1656
4 1851
4 2468
4 3702
4 4936
5 127
5 2797
6 7
7 13
7 37
7 91
7 111
7 169
7 259
7 481
7 507
7 777
7 1183
7 1443
7 3367
7 3549
8 10
8 55
8 59
8 110
8 121
8 220
8 236
8 295
8 463
8 484
8 590
8 605
8 926
8 118...

input:

2
5000 3132
1 2
1 3
1 3513
3 4
4 8
4 9
4 12
4 18
4 23
4 92
4 138
4 207
4 414
4 552
4 828
4 1656
4 1851
4 2468
4 3702
4 4936
5 127
5 2797
6 7
7 13
7 37
7 91
7 111
7 169
7 259
7 481
7 507
7 777
7 1183
7 1443
7 3367
7 3549
8 10
8 55
8 59
8 110
8 121
8 220
8 236
8 295
8 463
8 484
8 590
8 605
8 926
8 118...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1892kb

input:

3
969441916331132577

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
2 5
3 6
4 7
1 8
8 9
7 10
3 11
9 12
8 13
11 14
12 15
1 16
5 17
9 18
12 19
17 20
18 21
3 22
22 23
9 24
2 25
21 26
18 27
25 28
8 29
27 30
30 31
1 32
3 33
5...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
2 5
3 6
4 7
1 8
8 9
7 10
3 11
9 12
8 13
11 14
12 15
1 16
5 17
9 18
12 19
17 20
18 21
3 22
22 23
9 24
2 25
21 26
18 27
25 28
8 29
27 30
30 31
1 32
3 33
5...

output:

4
5000 2500
1 4
1 16
4 389
4 2723
6 61
6 183
6 1461
11 14
15 134
15 402
16 593
16 911
17 20
17 40
17 80
20 2341
22 23
22 85
23 46
28 103
30 31
30 93
31 38
35 797
35 1154
35 1594
40 43
40 1319
43 166
44 53
45 54
45 108
50 59
50 1121
51 163
51 489
51 978
53 809
53 1618
53 3236
54 1429
54 4287
57 60
57...

input:

4
5000 2500
1 4
1 16
4 389
4 2723
6 61
6 183
6 1461
11 14
15 134
15 402
16 593
16 911
17 20
17 40
17 80
20 2341
22 23
22 85
23 46
28 103
30 31
30 93
31 38
35 797
35 1154
35 1594
40 43
40 1319
43 166
44 53
45 54
45 108
50 59
50 1121
51 163
51 489
51 978
53 809
53 1618
53 3236
54 1429
54 4287
57 60
57...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1896kb

input:

3
929489812741933634

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
2 4
4 5
2 6
2 7
2 8
2 9
4 10
4 11
2 12
9 13
2 14
14 15
2 16
16 17
2 18
4 19
14 20
2 21
4 22
12 23
2 24
9 25
22 26
2 27
2 28
9 29
14 30
6 31
2 32
26 33
33 34...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
2 4
4 5
2 6
2 7
2 8
2 9
4 10
4 11
2 12
9 13
2 14
14 15
2 16
16 17
2 18
4 19
14 20
2 21
4 22
12 23
2 24
9 25
22 26
2 27
2 28
9 29
14 30
6 31
2 32
26 33
33 34...

output:

4
5000 2500
1 97
6 31
6 62
6 3373
7 2237
7 3847
8 593
8 1186
8 1779
8 3558
13 53
13 2269
14 15
14 20
14 60
15 179
15 1969
22 52
23 57
23 133
25 149
33 523
46 694
48 143
48 286
49 107
49 535
52 167
53 617
53 1851
56 3697
64 71
64 355
64 710
67 139
67 241
67 4031
69 73
69 365
71 1167
72 463
72 926
72 ...

input:

4
5000 2500
1 97
6 31
6 62
6 3373
7 2237
7 3847
8 593
8 1186
8 1779
8 3558
13 53
13 2269
14 15
14 20
14 60
15 179
15 1969
22 52
23 57
23 133
25 149
33 523
46 694
48 143
48 286
49 107
49 535
52 167
53 617
53 1851
56 3697
64 71
64 355
64 710
67 139
67 241
67 4031
69 73
69 365
71 1167
72 463
72 926
72 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1896kb

input:

3
144032041325838295

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
3 4
4 5
1 6
6 7
7 8
1 9
5 10
3 11
7 12
6 13
7 14
10 15
7 16
9 17
1 18
4 19
15 20
7 21
3 22
10 23
7 24
20 25
19 26
1 27
7 28
4 29
25 30
21 31
23 32
25 33
9 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
3 4
4 5
1 6
6 7
7 8
1 9
5 10
3 11
7 12
6 13
7 14
10 15
7 16
9 17
1 18
4 19
15 20
7 21
3 22
10 23
7 24
20 25
19 26
1 27
7 28
4 29
25 30
21 31
23 32
25 33
9 3...

output:

4
5000 2500
2 41
2 1097
6 13
6 1931
8 1013
8 4243
9 17
9 34
11 691
11 1382
11 2764
12 89
12 163
12 1297
15 40
17 613
17 1226
18 1373
24 61
24 457
24 1171
26 799
26 1951
29 3917
30 449
30 643
30 2245
30 3215
34 291
34 4051
37 863
37 1726
37 2589
40 249
40 415
40 1245
42 133
51 466
51 932
53 158
56 16...

input:

4
5000 2500
2 41
2 1097
6 13
6 1931
8 1013
8 4243
9 17
9 34
11 691
11 1382
11 2764
12 89
12 163
12 1297
15 40
17 613
17 1226
18 1373
24 61
24 457
24 1171
26 799
26 1951
29 3917
30 449
30 643
30 2245
30 3215
34 291
34 4051
37 863
37 1726
37 2589
40 249
40 415
40 1245
42 133
51 466
51 932
53 158
56 16...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

3
832110946250826180

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
4 5
5 6
1 7
4 8
3 9
9 10
4 11
11 12
3 13
8 14
14 15
4 16
2 17
12 18
18 19
19 20
15 21
4 22
17 23
12 24
5 25
16 26
12 27
8 28
22 29
29 30
12 31
4 32
15 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
4 5
5 6
1 7
4 8
3 9
9 10
4 11
11 12
3 13
8 14
14 15
4 16
2 17
12 18
18 19
19 20
15 21
4 22
17 23
12 24
5 25
16 26
12 27
8 28
22 29
29 30
12 31
4 32
15 3...

output:

4
5000 2500
1 7
1 1409
6 107
6 214
6 321
6 642
7 2521
7 4951
9 10
12 36
13 277
14 281
14 562
16 52
19 787
19 883
22 29
22 58
22 203
22 406
23 829
25 983
25 4915
27 1451
27 3467
27 4353
28 61
28 122
28 244
28 488
29 91
32 47
32 94
32 188
34 59
34 118
34 587
34 1174
36 37
36 42
36 48
36 51
36 56
36 68...

input:

4
5000 2500
1 7
1 1409
6 107
6 214
6 321
6 642
7 2521
7 4951
9 10
12 36
13 277
14 281
14 562
16 52
19 787
19 883
22 29
22 58
22 203
22 406
23 829
25 983
25 4915
27 1451
27 3467
27 4353
28 61
28 122
28 244
28 488
29 91
32 47
32 94
32 188
34 59
34 118
34 587
34 1174
36 37
36 42
36 48
36 51
36 56
36 68...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

3
85728715707691821

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
1 5
3 6
2 7
5 8
3 9
1 10
6 11
9 12
11 13
9 14
6 15
13 16
13 17
3 18
6 19
1 20
9 21
17 22
7 23
21 24
21 25
11 26
21 27
9 28
23 29
21 30
4 31
13 32
6 33
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
1 5
3 6
2 7
5 8
3 9
1 10
6 11
9 12
11 13
9 14
6 15
13 16
13 17
3 18
6 19
1 20
9 21
17 22
7 23
21 24
21 25
11 26
21 27
9 28
23 29
21 30
4 31
13 32
6 33
1...

output:

4
5000 2500
3 18
4 31
4 463
5 8
5 2102
5 4204
8 227
12 1777
12 2213
16 439
16 2195
16 3073
24 4583
28 313
28 3443
28 4451
31 4139
36 213
36 355
36 1065
40 1049
43 82
44 133
44 1999
48 409
48 3681
50 143
51 210
58 2303
59 383
59 766
59 1087
59 2174
62 953
62 1579
67 3637
72 77
72 231
72 1931
74 311
7...

input:

4
5000 2500
3 18
4 31
4 463
5 8
5 2102
5 4204
8 227
12 1777
12 2213
16 439
16 2195
16 3073
24 4583
28 313
28 3443
28 4451
31 4139
36 213
36 355
36 1065
40 1049
43 82
44 133
44 1999
48 409
48 3681
50 143
51 210
58 2303
59 383
59 766
59 1087
59 2174
62 953
62 1579
67 3637
72 77
72 231
72 1931
74 311
7...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1892kb

input:

5
777434612360931036

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
1 5
5 6
1 7
4 8
8 9
6 10
6 11
11 12
5 13
8 14
6 15
12 16
13 17
17 18
3 19
16 20
15 21
6 22
3 23
12 24
11 25
18 26
18 27
8 28
1 29
6 30
18 31
28 32
6 33
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
1 5
5 6
1 7
4 8
8 9
6 10
6 11
11 12
5 13
8 14
6 15
12 16
13 17
17 18
3 19
16 20
15 21
6 22
3 23
12 24
11 25
18 26
18 27
8 28
1 29
6 30
18 31
28 32
6 33
...

output:

6
5000 2543
1 2
3 19
4 8
5 6
5 13
5 37
5 481
7 1783
9 257
9 771
9 2313
10 1907
10 3814
11 12
11 25
11 137
11 167
11 685
11 835
11 3425
11 4175
14 397
14 794
15 21
15 4679
16 20
17 18
17 367
17 4037
22 38
22 133
22 266
24 4253
26 46
26 115
26 230
27 43
27 83
27 129
27 249
27 387
27 747
27 3569
28 32
...

input:

6
5000 2543
1 2
3 19
4 8
5 6
5 13
5 37
5 481
7 1783
9 257
9 771
9 2313
10 1907
10 3814
11 12
11 25
11 137
11 167
11 685
11 835
11 3425
11 4175
14 397
14 794
15 21
15 4679
16 20
17 18
17 367
17 4037
22 38
22 133
22 266
24 4253
26 46
26 115
26 230
27 43
27 83
27 129
27 249
27 387
27 747
27 3569
28 32
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

5
705262511549880222

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
2 4
2 5
5 6
1 7
6 8
6 9
2 10
4 11
6 12
3 13
8 14
12 15
14 16
14 17
6 18
15 19
2 20
15 21
4 22
10 23
6 24
22 25
16 26
24 27
22 28
21 29
12 30
30 31
30 32
15 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
2 4
2 5
5 6
1 7
6 8
6 9
2 10
4 11
6 12
3 13
8 14
12 15
14 16
14 17
6 18
15 19
2 20
15 21
4 22
10 23
6 24
22 25
16 26
24 27
22 28
21 29
12 30
30 31
30 32
15 ...

output:

6
5000 2529
1 7
2 3
2 4
2 5
2 10
2 20
2 101
2 202
2 404
2 505
2 1010
2 2020
6 8
6 9
6 12
6 18
6 24
6 36
6 72
6 113
6 226
6 339
6 452
6 678
6 904
6 1017
6 1356
6 2034
6 2712
6 4068
11 61
11 103
14 16
14 17
14 34
14 68
14 136
14 173
14 272
14 346
14 692
14 1384
14 2768
14 2941
15 19
15 21
15 33
15 57
...

input:

6
5000 2529
1 7
2 3
2 4
2 5
2 10
2 20
2 101
2 202
2 404
2 505
2 1010
2 2020
6 8
6 9
6 12
6 18
6 24
6 36
6 72
6 113
6 226
6 339
6 452
6 678
6 904
6 1017
6 1356
6 2034
6 2712
6 4068
11 61
11 103
14 16
14 17
14 34
14 68
14 136
14 173
14 272
14 346
14 692
14 1384
14 2768
14 2941
15 19
15 21
15 33
15 57
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1896kb

input:

5
510318082834167951

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
1 5
3 6
6 7
7 8
8 9
1 10
2 11
3 12
5 13
7 14
6 15
15 16
16 17
9 18
18 19
11 20
20 21
13 22
16 23
15 24
1 25
5 26
26 27
7 28
13 29
21 30
12 31
15 32
24 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
1 5
3 6
6 7
7 8
8 9
1 10
2 11
3 12
5 13
7 14
6 15
15 16
16 17
9 18
18 19
11 20
20 21
13 22
16 23
15 24
1 25
5 26
26 27
7 28
13 29
21 30
12 31
15 32
24 3...

output:

6
5000 2553
1 5
1 10
1 25
1 50
1 751
1 1502
1 3755
2 3
3 6
3 12
3 67
3 134
3 201
3 268
3 402
3 804
7 8
7 14
7 28
7 56
9 18
11 20
13 22
13 29
13 37
13 58
13 74
13 319
13 407
13 638
13 814
13 1073
13 2146
15 16
15 24
15 32
15 48
15 64
15 96
15 128
15 192
15 384
17 71
17 142
21 30
21 35
21 42
21 70
21 ...

input:

6
5000 2553
1 5
1 10
1 25
1 50
1 751
1 1502
1 3755
2 3
3 6
3 12
3 67
3 134
3 201
3 268
3 402
3 804
7 8
7 14
7 28
7 56
9 18
11 20
13 22
13 29
13 37
13 58
13 74
13 319
13 407
13 638
13 814
13 1073
13 2146
15 16
15 24
15 32
15 48
15 64
15 96
15 128
15 192
15 384
17 71
17 142
21 30
21 35
21 42
21 70
21 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1900kb

input:

5
914858813253258744

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
3 7
7 8
6 9
4 10
2 11
11 12
12 13
10 14
9 15
8 16
4 17
6 18
14 19
4 20
3 21
2 22
8 23
23 24
19 25
25 26
6 27
24 28
9 29
24 30
22 31
24 32
24 33
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
3 7
7 8
6 9
4 10
2 11
11 12
12 13
10 14
9 15
8 16
4 17
6 18
14 19
4 20
3 21
2 22
8 23
23 24
19 25
25 26
6 27
24 28
9 29
24 30
22 31
24 32
24 33
...

output:

6
5000 2545
1 2
3 4
3 7
3 21
3 49
3 147
5 6
8 16
8 23
8 41
8 46
8 61
8 82
8 92
8 122
8 164
8 184
8 227
8 244
8 328
8 368
8 449
8 454
8 488
8 521
8 656
8 898
8 908
8 943
8 976
8 1042
8 1403
8 1796
8 1816
8 1886
8 2084
8 2501
8 2806
8 3592
8 3632
8 3772
8 4168
9 15
9 29
9 87
9 145
9 435
10 14
11 12
11...

input:

6
5000 2545
1 2
3 4
3 7
3 21
3 49
3 147
5 6
8 16
8 23
8 41
8 46
8 61
8 82
8 92
8 122
8 164
8 184
8 227
8 244
8 328
8 368
8 449
8 454
8 488
8 521
8 656
8 898
8 908
8 943
8 976
8 1042
8 1403
8 1796
8 1816
8 1886
8 2084
8 2501
8 2806
8 3592
8 3632
8 3772
8 4168
9 15
9 29
9 87
9 145
9 435
10 14
11 12
11...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1900kb

input:

5
659635316746638238

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
1 3
2 4
3 5
4 6
6 7
6 8
1 9
8 10
6 11
10 12
6 13
6 14
13 15
14 16
4 17
10 18
3 19
18 20
13 21
6 22
1 23
22 24
13 25
6 26
19 27
6 28
28 29
28 30
23 31
30 32
28 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
1 3
2 4
3 5
4 6
6 7
6 8
1 9
8 10
6 11
10 12
6 13
6 14
13 15
14 16
4 17
10 18
3 19
18 20
13 21
6 22
1 23
22 24
13 25
6 26
19 27
6 28
28 29
28 30
23 31
30 32
28 3...

output:

6
5000 2527
1 2
2 173
2 346
2 692
3 5
3 19
3 95
3 107
3 223
3 535
3 1115
3 2033
3 4237
4 6
6 8
6 11
6 13
6 14
6 22
6 26
6 28
6 44
6 52
6 56
6 77
6 88
6 91
6 104
6 143
6 154
6 182
6 286
6 308
6 364
6 572
6 616
6 619
6 728
6 1001
6 1144
6 1238
6 2002
6 2476
6 4004
6 4333
6 4952
9 503
10 12
10 18
10 36...

input:

6
5000 2527
1 2
2 173
2 346
2 692
3 5
3 19
3 95
3 107
3 223
3 535
3 1115
3 2033
3 4237
4 6
6 8
6 11
6 13
6 14
6 22
6 26
6 28
6 44
6 52
6 56
6 77
6 88
6 91
6 104
6 143
6 154
6 182
6 286
6 308
6 364
6 572
6 616
6 619
6 728
6 1001
6 1144
6 1238
6 2002
6 2476
6 4004
6 4333
6 4952
9 503
10 12
10 18
10 36...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

7
858490260563149759

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
4 5
1 6
6 7
7 8
1 9
9 10
6 11
7 12
12 13
13 14
4 15
15 16
14 17
1 18
2 19
19 20
13 21
17 22
16 23
7 24
9 25
25 26
1 27
27 28
19 29
19 30
11 31
31 32
28 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
4 5
1 6
6 7
7 8
1 9
9 10
6 11
7 12
12 13
13 14
4 15
15 16
14 17
1 18
2 19
19 20
13 21
17 22
16 23
7 24
9 25
25 26
1 27
27 28
19 29
19 30
11 31
31 32
28 ...

output:

8
5000 2500
1 18
4 4863
5 718
6 71
6 497
6 781
6 4189
10 47
10 423
10 963
10 1317
10 3951
12 2713
14 17
17 22
21 86
21 3287
24 89
24 445
24 1321
26 1013
28 81
28 1089
28 3267
30 67
33 398
34 75
35 1318
35 2636
37 362
37 1086
37 3258
40 453
40 2869
43 277
43 554
43 1108
43 1381
43 1662
43 2762
43 332...

input:

8
5000 2500
1 18
4 4863
5 718
6 71
6 497
6 781
6 4189
10 47
10 423
10 963
10 1317
10 3951
12 2713
14 17
17 22
21 86
21 3287
24 89
24 445
24 1321
26 1013
28 81
28 1089
28 3267
30 67
33 398
34 75
35 1318
35 2636
37 362
37 1086
37 3258
40 453
40 2869
43 277
43 554
43 1108
43 1381
43 1662
43 2762
43 332...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

7
860058643727731209

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
1 4
4 5
3 6
6 7
1 8
6 9
9 10
3 11
9 12
8 13
13 14
9 15
9 16
6 17
15 18
4 19
9 20
6 21
3 22
5 23
9 24
9 25
21 26
15 27
13 28
5 29
9 30
12 31
9 32
3 33
23 34
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
1 4
4 5
3 6
6 7
1 8
6 9
9 10
3 11
9 12
8 13
13 14
9 15
9 16
6 17
15 18
4 19
9 20
6 21
3 22
5 23
9 24
9 25
21 26
15 27
13 28
5 29
9 30
12 31
9 32
3 33
23 34
...

output:

8
5000 2500
1 86
2 2887
4 19
7 1814
7 2237
7 4474
8 811
11 439
11 878
13 28
13 2258
13 4516
14 659
14 3295
15 18
16 389
20 53
20 371
22 4271
23 38
23 409
23 646
23 1433
23 2866
26 2801
31 562
33 72
36 1947
37 1321
37 1502
37 2642
37 3004
40 89
40 461
41 112
41 224
41 379
41 758
41 1516
41 3032
42 51...

input:

8
5000 2500
1 86
2 2887
4 19
7 1814
7 2237
7 4474
8 811
11 439
11 878
13 28
13 2258
13 4516
14 659
14 3295
15 18
16 389
20 53
20 371
22 4271
23 38
23 409
23 646
23 1433
23 2866
26 2801
31 562
33 72
36 1947
37 1321
37 1502
37 2642
37 3004
40 89
40 461
41 112
41 224
41 379
41 758
41 1516
41 3032
42 51...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1896kb

input:

7
718861404514377808

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
3 5
4 6
5 7
7 8
1 9
8 10
2 11
4 12
8 13
12 14
13 15
15 16
12 17
10 18
9 19
8 20
19 21
2 22
13 23
16 24
8 25
8 26
10 27
12 28
22 29
28 30
9 31
16 32
13 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
3 5
4 6
5 7
7 8
1 9
8 10
2 11
4 12
8 13
12 14
13 15
15 16
12 17
10 18
9 19
8 20
19 21
2 22
13 23
16 24
8 25
8 26
10 27
12 28
22 29
28 30
9 31
16 32
13 3...

output:

8
5000 2500
1 787
2 11
2 1111
2 2222
5 139
5 973
7 367
7 1101
9 1543
10 18
14 79
14 107
14 158
20 43
20 86
20 146
20 3139
24 88
26 721
26 1442
27 71
29 3383
30 2066
31 163
32 2672
32 2999
33 35
33 175
34 39
34 78
37 81
37 503
37 4527
38 470
39 53
41 113
41 419
49 2073
49 3093
51 2417
53 205
53 3169
...

input:

8
5000 2500
1 787
2 11
2 1111
2 2222
5 139
5 973
7 367
7 1101
9 1543
10 18
14 79
14 107
14 158
20 43
20 86
20 146
20 3139
24 88
26 721
26 1442
27 71
29 3383
30 2066
31 163
32 2672
32 2999
33 35
33 175
34 39
34 78
37 81
37 503
37 4527
38 470
39 53
41 113
41 419
49 2073
49 3093
51 2417
53 205
53 3169
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1896kb

input:

7
659192688464047828

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
3 5
4 6
6 7
4 8
7 9
8 10
2 11
4 12
12 13
6 14
13 15
4 16
6 17
16 18
17 19
8 20
13 21
2 22
13 23
4 24
3 25
12 26
16 27
20 28
13 29
28 30
28 31
20 32
13 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
1 3
3 4
3 5
4 6
6 7
4 8
7 9
8 10
2 11
4 12
12 13
6 14
13 15
4 16
6 17
16 18
17 19
8 20
13 21
2 22
13 23
4 24
3 25
12 26
16 27
20 28
13 29
28 30
28 31
20 32
13 3...

output:

8
5000 2500
3 3425
5 71
5 2309
8 1733
8 3466
10 997
10 2991
11 449
14 1433
14 2866
16 18
16 27
16 54
17 19
19 2693
23 677
23 1871
23 3385
24 1759
24 3518
24 4639
25 117
25 507
25 2197
26 614
29 37
32 521
32 2084
35 107
35 653
37 281
37 843
41 49
41 3557
42 1777
42 3554
43 1745
43 2837
43 3141
44 337...

input:

8
5000 2500
3 3425
5 71
5 2309
8 1733
8 3466
10 997
10 2991
11 449
14 1433
14 2866
16 18
16 27
16 54
17 19
19 2693
23 677
23 1871
23 3385
24 1759
24 3518
24 4639
25 117
25 507
25 2197
26 614
29 37
32 521
32 2084
35 107
35 653
37 281
37 843
41 49
41 3557
42 1777
42 3554
43 1745
43 2837
43 3141
44 337...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1896kb

input:

7
685730986714800201

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
1 4
1 5
3 6
6 7
1 8
3 9
1 10
10 11
9 12
6 13
7 14
6 15
9 16
7 17
3 18
13 19
1 20
20 21
21 22
12 23
9 24
1 25
19 26
12 27
21 28
1 29
21 30
6 31
9 32
21 33
7 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2
2 3
1 4
1 5
3 6
6 7
1 8
3 9
1 10
10 11
9 12
6 13
7 14
6 15
9 16
7 17
3 18
13 19
1 20
20 21
21 22
12 23
9 24
1 25
19 26
12 27
21 28
1 29
21 30
6 31
9 32
21 33
7 ...

output:

8
5000 2500
2 281
3 18
4 79
5 151
5 604
5 3742
8 131
10 11
13 38
16 4489
19 26
19 197
19 394
23 2906
23 2963
25 3769
27 1297
27 2594
28 2317
30 261
32 143
36 489
36 815
36 2445
37 124
42 2283
43 121
43 3181
46 3071
47 718
48 921
48 2763
49 137
49 548
49 3836
50 107
53 596
54 61
54 183
54 1727
55 94
...

input:

8
5000 2500
2 281
3 18
4 79
5 151
5 604
5 3742
8 131
10 11
13 38
16 4489
19 26
19 197
19 394
23 2906
23 2963
25 3769
27 1297
27 2594
28 2317
30 261
32 143
36 489
36 815
36 2445
37 124
42 2283
43 121
43 3181
46 3071
47 718
48 921
48 2763
49 137
49 548
49 3836
50 107
53 596
54 61
54 183
54 1727
55 94
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201