QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#463812#8726. Magic ShowXZC0920100 ✓0ms1836kbC++141.2kb2024-07-05 14:39:372024-07-05 14:39:37

Judging History

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

  • [2024-07-05 14:39:37]
  • 评测
  • 测评结果:100
  • 用时:0ms
  • 内存:1836kb
  • [2024-07-05 14:39:37]
  • 提交

Alice

#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
typedef int64_t i64;
vector<pair<int, int>> Alice()
{
    int n = 5000; i64 x = setN(n);
    vector<pair<int, int>> ans(n - 1);
    for(int i = 1; i < n; i++) ans[i - 1] = make_pair(x % i + 1, i + 1);
    return ans;
}

Bob

#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
typedef int64_t i64;
typedef __int128_t i128;
const i64 I = 1e18;
i64 x, y;
i64 exgcd(i64 a, i64 b, i64 &x, i64 &y) 
{
    if(b == 0) return x = 1, y = 0, a;
    i64 d = exgcd(b, a % b, y, x);
    return y -= (a / b) * x, d;
}
i128 mul(i128 a, i128 b, i128 mod) 
{
    i128 ans = 0;
    while(b)
    {
        if(b & 1) ans = (ans + a) % mod;
        a = (a + a) % mod; b >>= 1;
    }
    return ans;
}
long long Bob(vector<pair<int, int>> e) 
{
    i64 a = 1, b = 0; 
    for(auto u: e) 
    {
        i64 b2 = u.first - 1, a2 = u.second - 1;
        i64 d = exgcd(a, a2, x, y);
        i128 a3 = (i128)a * a2 / d, b3 = (mul((i128)x * ((b2 - b) / d) % a3, a, a3) + b) % a3;
        if(b3 < 0) b3 += a3;
        if(a3 > I) {b = b3; break;}
        a = a3, b = b3;
    }
    return b;
} 

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1808kb,1836kb

input:

1
4005

output:

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

input:

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

output:

2
5000 4545
1 2
1 4
1 6
1 10
1 16
1 46
1 90
1 268
1 446
1 802
1 1336
2 3
2 5
2 8
2 12
2 14
2 15
2 23
2 27
2 29
2 45
2 53
2 78
2 92
2 144
2 155
2 183
2 287
2 309
2 365
2 573
2 1002
2 2003
2 4005
3 4004
4 7
4 24
4 30
4 47
4 59
4 70
4 88
4 139
4 175
4 668
4 1335
4 2002
4 4003
5 4002
6 9
6 11
6 17
6 26
...

input:

2
5000 4545
1 2
1 4
1 6
1 10
1 16
1 46
1 90
1 268
1 446
1 802
1 1336
2 3
2 5
2 8
2 12
2 14
2 15
2 23
2 27
2 29
2 45
2 53
2 78
2 92
2 144
2 155
2 183
2 287
2 309
2 365
2 573
2 1002
2 2003
2 4005
3 4004
4 7
4 24
4 30
4 47
4 59
4 70
4 88
4 139
4 175
4 668
4 1335
4 2002
4 4003
5 4002
6 9
6 11
6 17
6 26
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1836kb

input:

1
459

output:

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

input:

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

output:

2
5000 4545
1 2
1 4
1 10
1 18
1 28
1 52
1 154
1 460
2 3
2 230
2 459
4 5
4 7
4 9
4 13
4 20
4 25
4 77
4 115
4 153
4 229
4 457
5 6
5 8
5 14
5 66
5 92
5 456
6 228
6 455
7 152
7 454
8 114
8 453
9 12
9 42
9 452
10 11
10 16
10 19
10 26
10 31
10 46
10 51
10 76
10 91
10 151
10 226
10 451
11 450
12 15
12 17
1...

input:

2
5000 4545
1 2
1 4
1 10
1 18
1 28
1 52
1 154
1 460
2 3
2 230
2 459
4 5
4 7
4 9
4 13
4 20
4 25
4 77
4 115
4 153
4 229
4 457
5 6
5 8
5 14
5 66
5 92
5 456
6 228
6 455
7 152
7 454
8 114
8 453
9 12
9 42
9 452
10 11
10 16
10 19
10 26
10 31
10 46
10 51
10 76
10 91
10 151
10 226
10 451
11 450
12 15
12 17
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1832kb

input:

1
2495

output:

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

input:

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

output:

2
5000 4545
1 2
1 6
1 500
1 2496
2 3
2 30
2 59
2 87
2 1248
2 2495
3 4
3 10
3 278
3 832
3 2494
4 5
4 8
4 15
4 29
4 90
4 179
4 357
4 624
4 1247
4 2493
5 48
5 54
5 2492
6 7
6 11
6 16
6 31
6 84
6 416
6 499
6 831
6 1246
6 2491
7 20
7 132
7 2490
8 9
8 312
8 623
8 1245
8 2489
9 830
9 2488
10 12
10 23
10 11...

input:

2
5000 4545
1 2
1 6
1 500
1 2496
2 3
2 30
2 59
2 87
2 1248
2 2495
3 4
3 10
3 278
3 832
3 2494
4 5
4 8
4 15
4 29
4 90
4 179
4 357
4 624
4 1247
4 2493
5 48
5 54
5 2492
6 7
6 11
6 16
6 31
6 84
6 416
6 499
6 831
6 1246
6 2491
7 20
7 132
7 2490
8 9
8 312
8 623
8 1245
8 2489
9 830
9 2488
10 12
10 23
10 11...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1816kb

input:

3
1560

output:

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

input:

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

output:

4
5000 3438
1 1561
1561 1562
1561 1563
1561 1564
1561 1565
1561 1566
1561 1567
1561 1568
1561 1569
1561 1570
1561 1571
1561 1572
1561 1573
1561 1574
1561 1575
1561 1576
1561 1577
1561 1578
1561 1579
1561 1580
1561 1581
1561 1582
1561 1583
1561 1584
1561 1585
1561 1586
1561 1587
1561 1588
1561 1589
1...

input:

4
5000 3438
1 1561
1561 1562
1561 1563
1561 1564
1561 1565
1561 1566
1561 1567
1561 1568
1561 1569
1561 1570
1561 1571
1561 1572
1561 1573
1561 1574
1561 1575
1561 1576
1561 1577
1561 1578
1561 1579
1561 1580
1561 1581
1561 1582
1561 1583
1561 1584
1561 1585
1561 1586
1561 1587
1561 1588
1561 1589
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

3
3594

output:

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

input:

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

output:

4
5000 2500
1 3595
2 3594
12 3584
14 3582
24 3572
36 3560
38 3558
48 3548
54 3542
56 3540
62 3534
66 3530
68 3528
78 3518
84 3512
96 3500
104 3492
114 3482
126 3470
128 3468
132 3464
134 3462
138 3458
146 3450
162 3434
164 3432
168 3428
182 3414
188 3408
192 3404
194 3402
198 3398
204 3392
206 3390
...

input:

4
5000 2500
1 3595
2 3594
12 3584
14 3582
24 3572
36 3560
38 3558
48 3548
54 3542
56 3540
62 3534
66 3530
68 3528
78 3518
84 3512
96 3500
104 3492
114 3482
126 3470
128 3468
132 3464
134 3462
138 3458
146 3450
162 3434
164 3432
168 3428
182 3414
188 3408
192 3404
194 3402
198 3398
204 3392
206 3390
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1816kb

input:

3
1750

output:

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

input:

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

output:

4
5000 3248
1 1751
1751 1752
1751 1753
1751 1754
1751 1755
1751 1756
1751 1757
1751 1758
1751 1759
1751 1760
1751 1761
1751 1762
1751 1763
1751 1764
1751 1765
1751 1766
1751 1767
1751 1768
1751 1769
1751 1770
1751 1771
1751 1772
1751 1773
1751 1774
1751 1775
1751 1776
1751 1777
1751 1778
1751 1779
1...

input:

4
5000 3248
1 1751
1751 1752
1751 1753
1751 1754
1751 1755
1751 1756
1751 1757
1751 1758
1751 1759
1751 1760
1751 1761
1751 1762
1751 1763
1751 1764
1751 1765
1751 1766
1751 1767
1751 1768
1751 1769
1751 1770
1751 1771
1751 1772
1751 1773
1751 1774
1751 1775
1751 1776
1751 1777
1751 1778
1751 1779
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

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

input:

5
4878

output:

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

input:

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

output:

6
5000 2560
1 2440
2 4878
3 5
3 24
3 47
3 54
3 93
3 107
3 213
3 1220
3 2439
3 4877
4 6
4 14
4 16
4 26
4 40
4 66
4 76
4 126
4 196
4 326
4 376
4 976
4 1626
4 4876
7 8
7 9
7 13
7 15
7 22
7 25
7 29
7 30
7 43
7 57
7 59
7 85
7 88
7 117
7 169
7 175
7 204
7 233
7 349
7 407
7 610
7 697
7 813
7 1219
7 1625
7 ...

input:

6
5000 2560
1 2440
2 4878
3 5
3 24
3 47
3 54
3 93
3 107
3 213
3 1220
3 2439
3 4877
4 6
4 14
4 16
4 26
4 40
4 66
4 76
4 126
4 196
4 326
4 376
4 976
4 1626
4 4876
7 8
7 9
7 13
7 15
7 22
7 25
7 29
7 30
7 43
7 57
7 59
7 85
7 88
7 117
7 169
7 175
7 204
7 233
7 349
7 407
7 610
7 697
7 813
7 1219
7 1625
7 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1836kb

input:

5
1223

output:

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

input:

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

output:

6
5000 4388
1 2
2 3
2 14
2 27
2 48
2 95
2 1223
4 5
4 6
4 11
4 21
4 62
4 123
4 245
4 306
4 611
4 1221
7 1218
8 9
8 17
8 20
8 33
8 39
8 65
8 77
8 153
8 305
8 609
8 1217
10 608
10 1215
12 13
12 102
12 203
12 304
12 405
12 607
12 1213
15 32
15 40
15 94
15 404
15 1210
16 152
16 303
16 605
16 1209
18 19
1...

input:

6
5000 4388
1 2
2 3
2 14
2 27
2 48
2 95
2 1223
4 5
4 6
4 11
4 21
4 62
4 123
4 245
4 306
4 611
4 1221
7 1218
8 9
8 17
8 20
8 33
8 39
8 65
8 77
8 153
8 305
8 609
8 1217
10 608
10 1215
12 13
12 102
12 203
12 304
12 405
12 607
12 1213
15 32
15 40
15 94
15 404
15 1210
16 152
16 303
16 605
16 1209
18 19
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1836kb

input:

5
648

output:

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

input:

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

output:

6
5000 4675
1 325
2 648
3 18
3 20
3 35
3 39
3 324
3 647
4 6
4 16
4 44
4 130
4 216
4 646
5 8
5 15
5 24
5 29
5 47
5 93
5 162
5 323
5 645
7 108
7 215
7 322
7 643
9 11
9 17
9 21
9 33
9 41
9 65
9 81
9 129
9 161
9 321
9 641
10 72
10 214
10 640
12 14
12 50
12 92
12 638
13 54
13 107
13 160
13 213
13 319
13 ...

input:

6
5000 4675
1 325
2 648
3 18
3 20
3 35
3 39
3 324
3 647
4 6
4 16
4 44
4 130
4 216
4 646
5 8
5 15
5 24
5 29
5 47
5 93
5 162
5 323
5 645
7 108
7 215
7 322
7 643
9 11
9 17
9 21
9 33
9 41
9 65
9 81
9 129
9 161
9 321
9 641
10 72
10 214
10 640
12 14
12 50
12 92
12 638
13 54
13 107
13 160
13 213
13 319
13 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

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

input:

7
4475

output:

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

input:

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

output:

8
5000 2500
9 4468
13 4464
15 4462
19 4458
25 4452
27 4450
29 4448
33 4444
34 2222
34 4443
35 4442
37 4440
41 4436
47 4430
49 4428
50 4427
53 4424
55 4422
59 4418
61 4416
62 4415
63 4414
65 4412
67 4410
70 2204
70 4407
71 4406
77 4400
79 4398
83 4394
85 4392
89 4388
91 4386
95 4382
97 4380
99 4378
1...

input:

8
5000 2500
9 4468
13 4464
15 4462
19 4458
25 4452
27 4450
29 4448
33 4444
34 2222
34 4443
35 4442
37 4440
41 4436
47 4430
49 4428
50 4427
53 4424
55 4422
59 4418
61 4416
62 4415
63 4414
65 4412
67 4410
70 2204
70 4407
71 4406
77 4400
79 4398
83 4394
85 4392
89 4388
91 4386
95 4382
97 4380
99 4378
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1808kb

input:

7
4240

output:

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

input:

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

output:

8
5000 2500
10 4232
12 4230
14 4228
15 4227
19 4223
22 4220
24 4218
28 4214
30 4212
34 4208
40 4202
43 4199
44 4198
46 840
46 4196
48 4194
54 4188
58 4184
60 4182
63 4179
64 4178
67 4175
70 4172
72 4170
75 2084
75 4167
78 4164
79 2082
79 4163
82 4160
84 4158
88 4154
90 4152
96 4146
98 4144
100 4142
...

input:

8
5000 2500
10 4232
12 4230
14 4228
15 4227
19 4223
22 4220
24 4218
28 4214
30 4212
34 4208
40 4202
43 4199
44 4198
46 840
46 4196
48 4194
54 4188
58 4184
60 4182
63 4179
64 4178
67 4175
70 4172
72 4170
75 2084
75 4167
78 4164
79 2082
79 4163
82 4160
84 4158
88 4154
90 4152
96 4146
98 4144
100 4142
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

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

input:

7
1291

output:

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

input:

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

output:

8
5000 2500
1292 1293
1292 1294
1292 1296
1292 1297
1292 1298
1292 1299
1292 1300
1292 1302
1292 1303
1292 1304
1292 1306
1292 1307
1292 1310
1292 1311
1292 1312
1292 1313
1292 1314
1292 1315
1292 1317
1292 1318
1292 1319
1292 1323
1292 1324
1292 1326
1292 1331
1292 1332
1292 1333
1292 1334
1292 133...

input:

8
5000 2500
1292 1293
1292 1294
1292 1296
1292 1297
1292 1298
1292 1299
1292 1300
1292 1302
1292 1303
1292 1304
1292 1306
1292 1307
1292 1310
1292 1311
1292 1312
1292 1313
1292 1314
1292 1315
1292 1317
1292 1318
1292 1319
1292 1323
1292 1324
1292 1326
1292 1331
1292 1332
1292 1333
1292 1334
1292 133...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1812kb

input:

1
17476204

output:

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

input:

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

output:

2
5000 2850
1 2
1 3
1 5
1 18
1 35
1 69
2 322
5 6
5 13
5 16
5 19
5 21
5 26
5 31
5 39
5 41
5 43
5 46
5 51
5 57
5 61
5 71
5 74
5 76
5 115
5 127
5 134
5 151
5 176
5 181
5 201
5 229
5 293
5 301
5 316
5 351
5 361
5 381
5 421
5 457
5 526
5 533
5 571
5 585
5 601
5 666
5 701
5 731
5 761
5 799
5 841
5 856
5 8...

input:

2
5000 2850
1 2
1 3
1 5
1 18
1 35
1 69
2 322
5 6
5 13
5 16
5 19
5 21
5 26
5 31
5 39
5 41
5 43
5 46
5 51
5 57
5 61
5 71
5 74
5 76
5 115
5 127
5 134
5 151
5 176
5 181
5 201
5 229
5 293
5 301
5 316
5 351
5 361
5 381
5 421
5 457
5 526
5 533
5 571
5 585
5 601
5 666
5 701
5 731
5 761
5 799
5 841
5 856
5 8...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

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

input:

1
11926600

output:

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

input:

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

output:

2
5000 2850
1 2
1 3
1 5
1 6
1 21
1 26
1 41
1 50
1 51
1 57
1 71
1 99
1 176
1 197
1 201
1 351
1 701
1 981
1 1226
1 1401
1 1961
1 2435
1 4869
1 4901
2 32
2 94
2 258
2 1498
3 30
3 59
3 62
3 123
3 3372
3 3539
4 2138
5 13
5 34
7 74
9 33
9 65
9 663
9 1127
9 1325
9 2253
9 2649
9 4505
10 180
11 14
11 16
11 2...

input:

2
5000 2850
1 2
1 3
1 5
1 6
1 21
1 26
1 41
1 50
1 51
1 57
1 71
1 99
1 176
1 197
1 201
1 351
1 701
1 981
1 1226
1 1401
1 1961
1 2435
1 4869
1 4901
2 32
2 94
2 258
2 1498
3 30
3 59
3 62
3 123
3 3372
3 3539
4 2138
5 13
5 34
7 74
9 33
9 65
9 663
9 1127
9 1325
9 2253
9 2649
9 4505
10 180
11 14
11 16
11 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1808kb,1812kb

input:

1
16602378

output:

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

input:

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

output:

2
5000 2850
1 2
1 3
1 14
1 27
1 40
1 79
3 5
3 50
3 57
3 99
3 197
3 1149
3 2067
3 2297
3 4133
4 6
4 16
4 26
4 76
5 48
5 95
5 479
5 740
5 1479
6 2418
7 13
7 19
7 198
7 592
7 789
7 2342
7 2365
7 4683
8 200
8 3782
8 4392
9 18
9 35
9 62
9 123
9 171
9 306
9 611
9 1038
9 2075
9 3203
11 33
11 65
11 129
11 2...

input:

2
5000 2850
1 2
1 3
1 14
1 27
1 40
1 79
3 5
3 50
3 57
3 99
3 197
3 1149
3 2067
3 2297
3 4133
4 6
4 16
4 26
4 76
5 48
5 95
5 479
5 740
5 1479
6 2418
7 13
7 19
7 198
7 592
7 789
7 2342
7 2365
7 4683
8 200
8 3782
8 4392
9 18
9 35
9 62
9 123
9 171
9 306
9 611
9 1038
9 2075
9 3203
11 33
11 65
11 129
11 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

3
13129243

output:

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

input:

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

output:

4
5000 2500
6 468
6 935
7 12
9 36
10 1227
11 44
12 17
17 374
17 1120
17 3358
17 3912
19 42
19 1026
21 264
23 108
23 322
23 750
23 2248
24 27
24 66
24 131
24 261
25 2730
25 4812
28 33
28 65
28 129
28 257
28 513
33 60
33 1154
36 948
36 1734
36 1895
36 3467
36 3789
37 50
37 638
38 168
38 335
38 502
38 ...

input:

4
5000 2500
6 468
6 935
7 12
9 36
10 1227
11 44
12 17
17 374
17 1120
17 3358
17 3912
19 42
19 1026
21 264
23 108
23 322
23 750
23 2248
24 27
24 66
24 131
24 261
25 2730
25 4812
28 33
28 65
28 129
28 257
28 513
33 60
33 1154
36 948
36 1734
36 1895
36 3467
36 3789
37 50
37 638
38 168
38 335
38 502
38 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1808kb

input:

3
7892141

output:

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

input:

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

output:

4
5000 2500
1 200
3 4
4 84
4 167
5 12
5 408
9 558
9 1672
9 4724
11 42
12 16
12 31
16 23
19 878
25 2714
25 2910
26 548
26 1095
26 2189
26 3608
29 858
30 49
32 359
32 896
32 1791
32 4410
33 228
33 2044
33 3864
37 116
37 1496
39 74
39 220
42 46
42 51
42 55
42 61
42 75
42 76
42 80
42 91
42 101
42 109
42...

input:

4
5000 2500
1 200
3 4
4 84
4 167
5 12
5 408
9 558
9 1672
9 4724
11 42
12 16
12 31
16 23
19 878
25 2714
25 2910
26 548
26 1095
26 2189
26 3608
29 858
30 49
32 359
32 896
32 1791
32 4410
33 228
33 2044
33 3864
37 116
37 1496
39 74
39 220
42 46
42 51
42 55
42 61
42 75
42 76
42 80
42 91
42 101
42 109
42...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

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

input:

3
21314775

output:

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

input:

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

output:

4
5000 2500
1 112
2 3
2 14
2 27
9 440
9 2112
10 12
10 34
10 67
11 1232
11 3464
12 854
12 1707
12 3413
14 15
17 74
20 87
20 173
25 58
26 51
26 126
26 251
29 1238
34 62
34 123
34 367
35 1268
38 75
38 114
38 227
38 2550
38 4182
39 102
39 240
39 884
41 48
41 612
41 3056
42 138
42 275
42 960
42 1919
53 8...

input:

4
5000 2500
1 112
2 3
2 14
2 27
9 440
9 2112
10 12
10 34
10 67
11 1232
11 3464
12 854
12 1707
12 3413
14 15
17 74
20 87
20 173
25 58
26 51
26 126
26 251
29 1238
34 62
34 123
34 367
35 1268
38 75
38 114
38 227
38 2550
38 4182
39 102
39 240
39 884
41 48
41 612
41 3056
42 138
42 275
42 960
42 1919
53 8...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

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

input:

5
5559540

output:

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

input:

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

output:

6
5000 2532
1 3
2 2334
2 2384
4 24
4 70
4 198
4 410
4 592
4 1228
4 4532
5 9
5 17
5 48
5 95
5 189
5 377
5 753
6 284
6 1416
6 3930
7 10
7 19
7 74
7 147
7 220
7 439
7 658
7 1315
7 4232
8 20
8 134
13 14
13 25
13 27
13 40
13 53
13 79
13 104
13 105
13 157
13 174
13 207
13 310
13 313
13 347
13 413
13 520
1...

input:

6
5000 2532
1 3
2 2334
2 2384
4 24
4 70
4 198
4 410
4 592
4 1228
4 4532
5 9
5 17
5 48
5 95
5 189
5 377
5 753
6 284
6 1416
6 3930
7 10
7 19
7 74
7 147
7 220
7 439
7 658
7 1315
7 4232
8 20
8 134
13 14
13 25
13 27
13 40
13 53
13 79
13 104
13 105
13 157
13 174
13 207
13 310
13 313
13 347
13 413
13 520
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

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

input:

5
9424319

output:

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

input:

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

output:

6
5000 2642
1 2
2 84
2 167
3 4
4 12
4 23
4 45
5 6
6 7
6 19
8 9
10 11
13 18
13 38
13 630
14 60
14 119
15 16
15 34
15 46
15 56
15 80
15 100
15 166
15 238
15 242
15 396
15 496
15 712
15 724
15 870
15 1186
15 1206
15 2170
15 2608
15 2652
15 3556
15 3616
15 4346
17 390
17 2724
17 3462
20 21
20 26
20 51
2...

input:

6
5000 2642
1 2
2 84
2 167
3 4
4 12
4 23
4 45
5 6
6 7
6 19
8 9
10 11
13 18
13 38
13 630
14 60
14 119
15 16
15 34
15 46
15 56
15 80
15 100
15 166
15 238
15 242
15 396
15 496
15 712
15 724
15 870
15 1186
15 1206
15 2170
15 2608
15 2652
15 3556
15 3616
15 4346
17 390
17 2724
17 3462
20 21
20 26
20 51
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

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

input:

5
10955780

output:

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

input:

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

output:

6
5000 2505
1 5
2 284
3 4
3 7
5 9
5 14
5 27
5 33
5 53
5 65
5 105
5 129
5 209
5 257
5 417
5 513
5 824
5 833
5 1025
5 1647
5 1665
5 3293
5 3329
6 16
6 26
6 76
8 68
8 102
8 1620
10 2478
10 4424
11 15
11 36
11 71
12 18
12 34
12 52
12 60
12 178
12 188
12 332
12 562
12 650
12 994
12 1004
12 1948
12 3010
1...

input:

6
5000 2505
1 5
2 284
3 4
3 7
5 9
5 14
5 27
5 33
5 53
5 65
5 105
5 129
5 209
5 257
5 417
5 513
5 824
5 833
5 1025
5 1647
5 1665
5 3293
5 3329
6 16
6 26
6 76
8 68
8 102
8 1620
10 2478
10 4424
11 15
11 36
11 71
12 18
12 34
12 52
12 60
12 178
12 188
12 332
12 562
12 650
12 994
12 1004
12 1948
12 3010
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1808kb,1804kb

input:

7
19938721

output:

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

input:

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

output:

8
5000 2500
4 30
4 59
5 10
5 82
5 1918
5 3468
7 374
7 1866
8 39
9 44
9 4344
9 4592
11 40
11 1110
11 1384
11 3328
13 74
14 38
14 75
14 112
14 334
14 1333
16 54
16 107
16 1374
16 2747
17 256
20 43
20 728
20 1307
20 1455
20 1960
20 2182
20 3919
20 4363
20 4572
21 108
25 548
26 60
26 119
26 237
26 355
2...

input:

8
5000 2500
4 30
4 59
5 10
5 82
5 1918
5 3468
7 374
7 1866
8 39
9 44
9 4344
9 4592
11 40
11 1110
11 1384
11 3328
13 74
14 38
14 75
14 112
14 334
14 1333
16 54
16 107
16 1374
16 2747
17 256
20 43
20 728
20 1307
20 1455
20 1960
20 2182
20 3919
20 4363
20 4572
21 108
25 548
26 60
26 119
26 237
26 355
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1808kb,1804kb

input:

7
5129508

output:

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

input:

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

output:

8
5000 2500
2 332
3 20
3 24
3 438
7 15
9 101
9 126
9 501
10 54
10 160
16 564
16 3038
17 798
17 1595
17 1610
18 30
18 74
18 2424
23 95
23 198
26 1910
26 2688
32 338
32 492
34 196
34 976
35 299
35 1044
35 2087
35 2460
35 4919
36 108
37 97
37 129
37 769
38 1202
38 4272
40 124
40 370
42 50
43 72
43 214
...

input:

8
5000 2500
2 332
3 20
3 24
3 438
7 15
9 101
9 126
9 501
10 54
10 160
16 564
16 3038
17 798
17 1595
17 1610
18 30
18 74
18 2424
23 95
23 198
26 1910
26 2688
32 338
32 492
34 196
34 976
35 299
35 1044
35 2087
35 2460
35 4919
36 108
37 97
37 129
37 769
38 1202
38 4272
40 124
40 370
42 50
43 72
43 214
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1808kb

input:

7
15332941

output:

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

input:

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

output:

8
5000 2500
4 168
4 3167
4 4844
9 12
9 50
15 24
17 26
17 76
18 77
18 459
18 882
18 917
18 3525
21 164
21 864
28 2183
29 332
29 994
29 2980
31 102
31 374
31 1112
31 3738
31 4104
32 63
33 272
33 1952
34 1413
35 574
37 96
37 666
39 138
40 483
40 2448
40 4895
49 368
49 1020
52 719
52 1796
52 3591
57 194...

input:

8
5000 2500
4 168
4 3167
4 4844
9 12
9 50
15 24
17 26
17 76
18 77
18 459
18 882
18 917
18 3525
21 164
21 864
28 2183
29 332
29 994
29 2980
31 102
31 374
31 1112
31 3738
31 4104
32 63
33 272
33 1952
34 1413
35 574
37 96
37 666
39 138
40 483
40 2448
40 4895
49 368
49 1020
52 719
52 1796
52 3591
57 194...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1812kb

input:

1
355365355024496523

output:

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

input:

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

output:

2
5000 2850
1 2
1 380
1 1138
2 3
3 258
4 5
4 6
4 13
4 16
4 19
4 21
4 31
4 34
4 41
4 46
4 56
4 61
4 89
4 100
4 111
4 181
4 221
4 265
4 284
4 361
4 397
4 441
4 567
4 991
4 1133
4 1416
4 1981
4 2265
4 2548
4 2831
4 3114
4 3961
4 4246
6 14
6 27
6 107
6 1379
7 32
7 94
10 38
10 47
10 70
10 84
10 112
10 13...

input:

2
5000 2850
1 2
1 380
1 1138
2 3
3 258
4 5
4 6
4 13
4 16
4 19
4 21
4 31
4 34
4 41
4 46
4 56
4 61
4 89
4 100
4 111
4 181
4 221
4 265
4 284
4 361
4 397
4 441
4 567
4 991
4 1133
4 1416
4 1981
4 2265
4 2548
4 2831
4 3114
4 3961
4 4246
6 14
6 27
6 107
6 1379
7 32
7 94
10 38
10 47
10 70
10 84
10 112
10 13...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1812kb

input:

1
727827999106414164

output:

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

input:

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

output:

2
5000 2850
1 2
1 3
1 5
1 13
1 43
1 132
1 263
1 328
1 394
1 437
1 525
1 655
1 764
1 1309
1 2752
3 243
4 62
5 6
5 21
5 41
5 81
6 138
7 19
10 16
11 14
11 27
11 194
11 387
11 1232
11 4800
12 18
12 198
12 338
14 210
15 26
15 51
15 71
15 114
15 176
15 227
15 351
15 566
15 792
15 2826
16 718
16 2152
17 24...

input:

2
5000 2850
1 2
1 3
1 5
1 13
1 43
1 132
1 263
1 328
1 394
1 437
1 525
1 655
1 764
1 1309
1 2752
3 243
4 62
5 6
5 21
5 41
5 81
6 138
7 19
10 16
11 14
11 27
11 194
11 387
11 1232
11 4800
12 18
12 198
12 338
14 210
15 26
15 51
15 71
15 114
15 176
15 227
15 351
15 566
15 792
15 2826
16 718
16 2152
17 24...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1812kb

input:

1
656410143989222955

output:

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

input:

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

output:

2
5000 2850
1 2
1 6
1 16
1 28
1 46
1 82
1 84
1 136
1 250
1 406
1 416
1 748
1 1246
1 2242
1 3736
2 3
2 18
2 35
2 4484
4 5
4 13
4 43
4 57
4 2084
4 4167
5 74
6 26
6 51
7 348
8 14
8 27
8 53
8 1584
8 3167
9 38
9 1518
10 19
10 47
10 70
10 139
10 402
10 803
10 1204
10 3610
12 33
15 198
16 21
16 31
16 39
16...

input:

2
5000 2850
1 2
1 6
1 16
1 28
1 46
1 82
1 84
1 136
1 250
1 406
1 416
1 748
1 1246
1 2242
1 3736
2 3
2 18
2 35
2 4484
4 5
4 13
4 43
4 57
4 2084
4 4167
5 74
6 26
6 51
7 348
8 14
8 27
8 53
8 1584
8 3167
9 38
9 1518
10 19
10 47
10 70
10 139
10 402
10 803
10 1204
10 3610
12 33
15 198
16 21
16 31
16 39
16...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1816kb

input:

1
410366615149657534

output:

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

input:

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

output:

2
5000 2850
1 2
1 3
1 74
3 5
3 47
3 72
3 93
3 107
3 143
3 285
3 2439
3 3267
3 4877
5 6
5 14
5 16
5 19
5 27
5 28
5 31
5 40
5 43
5 46
5 71
5 79
5 92
5 118
5 127
5 136
5 235
5 274
5 316
5 379
5 391
5 547
5 586
5 703
5 946
5 1171
5 1639
5 2458
5 2731
5 3511
5 4096
5 4915
7 3959
9 32
9 39
9 63
9 1179
10 ...

input:

2
5000 2850
1 2
1 3
1 74
3 5
3 47
3 72
3 93
3 107
3 143
3 285
3 2439
3 3267
3 4877
5 6
5 14
5 16
5 19
5 27
5 28
5 31
5 40
5 43
5 46
5 71
5 79
5 92
5 118
5 127
5 136
5 235
5 274
5 316
5 379
5 391
5 547
5 586
5 703
5 946
5 1171
5 1639
5 2458
5 2731
5 3511
5 4096
5 4915
7 3959
9 32
9 39
9 63
9 1179
10 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1812kb

input:

1
298090682780948428

output:

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

input:

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

output:

2
5000 2850
1 2
1 3
1 5
1 32
1 50
1 63
1 99
1 125
1 197
1 344
1 435
1 629
1 687
1 869
1 1100
1 1373
1 1520
1 2199
1 4868
2 1172
2 3514
4 6
4 26
5 13
5 19
5 47
5 70
5 93
5 139
5 553
5 618
5 1657
5 4937
6 398
6 2798
8 14
8 38
8 40
8 92
8 112
8 260
8 274
8 508
8 1444
8 3368
8 3550
9 21
9 56
9 60
9 111
...

input:

2
5000 2850
1 2
1 3
1 5
1 32
1 50
1 63
1 99
1 125
1 197
1 344
1 435
1 629
1 687
1 869
1 1100
1 1373
1 1520
1 2199
1 4868
2 1172
2 3514
4 6
4 26
5 13
5 19
5 47
5 70
5 93
5 139
5 553
5 618
5 1657
5 4937
6 398
6 2798
8 14
8 38
8 40
8 92
8 112
8 260
8 274
8 508
8 1444
8 3368
8 3550
9 21
9 56
9 60
9 111
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1808kb,1804kb

input:

3
969441916331132577

output:

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

input:

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

output:

4
5000 2500
5 390
5 2724
7 62
7 184
7 1462
12 15
16 135
16 403
17 594
17 912
18 21
18 41
18 81
21 2342
23 86
24 47
29 104
31 32
31 94
32 39
36 798
36 1155
36 1595
41 44
41 1320
44 167
45 54
46 55
46 109
51 60
51 1122
52 164
52 490
52 979
54 810
54 1619
54 3237
55 1430
55 4288
58 61
58 121
60 132
60 ...

input:

4
5000 2500
5 390
5 2724
7 62
7 184
7 1462
12 15
16 135
16 403
17 594
17 912
18 21
18 41
18 81
21 2342
23 86
24 47
29 104
31 32
31 94
32 39
36 798
36 1155
36 1595
41 44
41 1320
44 167
45 54
46 55
46 109
51 60
51 1122
52 164
52 490
52 979
54 810
54 1619
54 3237
55 1430
55 4288
58 61
58 121
60 132
60 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1808kb

input:

3
929489812741933634

output:

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

input:

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

output:

4
5000 2500
2 98
7 32
7 63
7 3374
8 2238
8 3848
9 594
9 1187
9 1780
9 3559
14 54
14 2270
15 16
15 21
15 61
16 180
16 1970
23 53
24 58
24 134
26 150
34 524
47 695
49 144
49 287
50 108
50 536
53 168
54 618
54 1852
57 3698
65 72
65 356
65 711
68 140
68 242
68 4032
70 74
70 366
72 1168
73 464
73 927
73 ...

input:

4
5000 2500
2 98
7 32
7 63
7 3374
8 2238
8 3848
9 594
9 1187
9 1780
9 3559
14 54
14 2270
15 16
15 21
15 61
16 180
16 1970
23 53
24 58
24 134
26 150
34 524
47 695
49 144
49 287
50 108
50 536
53 168
54 618
54 1852
57 3698
65 72
65 356
65 711
68 140
68 242
68 4032
70 74
70 366
72 1168
73 464
73 927
73 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

3
144032041325838295

output:

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

input:

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

output:

4
5000 2500
1 3138
3 42
3 1098
7 14
7 1932
9 1014
9 4244
10 18
10 35
12 692
12 1383
12 2765
13 90
13 164
13 1298
16 41
18 614
18 1227
19 1374
25 62
25 458
25 1172
27 800
27 1952
30 3918
31 450
31 644
31 2246
31 3216
35 292
35 4052
38 864
38 1727
38 2590
41 250
41 416
41 1246
43 134
52 467
52 933
54 ...

input:

4
5000 2500
1 3138
3 42
3 1098
7 14
7 1932
9 1014
9 4244
10 18
10 35
12 692
12 1383
12 2765
13 90
13 164
13 1298
16 41
18 614
18 1227
19 1374
25 62
25 458
25 1172
27 800
27 1952
30 3918
31 450
31 644
31 2246
31 3216
35 292
35 4052
38 864
38 1727
38 2590
41 250
41 416
41 1246
43 134
52 467
52 933
54 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1808kb

input:

3
832110946250826180

output:

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

input:

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

output:

4
5000 2500
2 8
2 1410
4 10
4 14
4 40
4 118
7 108
7 215
7 322
7 643
8 2522
8 4952
13 37
14 278
15 282
15 563
17 53
20 788
20 884
23 30
23 59
23 204
23 407
24 830
26 984
26 4916
28 1452
28 3468
28 4354
29 62
29 123
29 245
29 489
30 92
33 48
33 95
33 189
35 60
35 119
35 588
35 1175
37 38
37 43
37 49
3...

input:

4
5000 2500
2 8
2 1410
4 10
4 14
4 40
4 118
7 108
7 215
7 322
7 643
8 2522
8 4952
13 37
14 278
15 282
15 563
17 53
20 788
20 884
23 30
23 59
23 204
23 407
24 830
26 984
26 4916
28 1452
28 3468
28 4354
29 62
29 123
29 245
29 489
30 92
33 48
33 95
33 189
35 60
35 119
35 588
35 1175
37 38
37 43
37 49
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1800kb

input:

3
85728715707691821

output:

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

input:

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

output:

4
5000 2500
1 4
4 19
5 32
5 464
6 9
6 2103
6 4205
9 228
13 1778
13 2214
17 440
17 2196
17 3074
25 4584
29 314
29 3444
29 4452
32 4140
37 214
37 356
37 1066
41 1050
44 83
45 134
45 2000
49 410
49 3682
51 144
52 211
59 2304
60 384
60 767
60 1088
60 2175
63 954
63 1580
68 3638
73 78
73 232
73 1932
75 3...

input:

4
5000 2500
1 4
4 19
5 32
5 464
6 9
6 2103
6 4205
9 228
13 1778
13 2214
17 440
17 2196
17 3074
25 4584
29 314
29 3444
29 4452
32 4140
37 214
37 356
37 1066
41 1050
44 83
45 134
45 2000
49 410
49 3682
51 144
52 211
59 2304
60 384
60 767
60 1088
60 2175
63 954
63 1580
68 3638
73 78
73 232
73 1932
75 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

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

input:

5
777434612360931036

output:

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

input:

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

output:

6
5000 2509
1 2
1 4
1 5
1 7
1 10
1 13
1 19
1 37
1 158
1 264
1 315
1 472
1 527
1 629
1 790
1 943
1 1053
1 1414
1 1579
1 1885
1 2368
1 2827
1 3157
1 4735
6 14
6 38
6 482
8 1784
9 15
9 29
11 1908
11 3815
12 26
12 138
12 168
12 686
12 836
12 3426
12 4176
16 22
16 4680
17 21
18 368
18 4038
23 39
23 134
2...

input:

6
5000 2509
1 2
1 4
1 5
1 7
1 10
1 13
1 19
1 37
1 158
1 264
1 315
1 472
1 527
1 629
1 790
1 943
1 1053
1 1414
1 1579
1 1885
1 2368
1 2827
1 3157
1 4735
6 14
6 38
6 482
8 1784
9 15
9 29
11 1908
11 3815
12 26
12 138
12 168
12 686
12 836
12 3426
12 4176
16 22
16 4680
17 21
18 368
18 4038
23 39
23 134
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

5
705262511549880222

output:

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

input:

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

output:

6
5000 2527
1 2
3 5
3 6
3 11
3 21
3 102
3 203
3 405
3 506
3 1011
3 2021
4 14
4 40
4 170
4 508
7 9
7 10
7 13
7 19
7 25
7 37
7 73
7 114
7 227
7 340
7 453
7 679
7 905
7 1018
7 1357
7 2035
7 2713
7 4069
12 62
12 104
15 17
15 18
15 35
15 69
15 137
15 174
15 273
15 347
15 693
15 1385
15 2769
15 2942
16 20...

input:

6
5000 2527
1 2
3 5
3 6
3 11
3 21
3 102
3 203
3 405
3 506
3 1011
3 2021
4 14
4 40
4 170
4 508
7 9
7 10
7 13
7 19
7 25
7 37
7 73
7 114
7 227
7 340
7 453
7 679
7 905
7 1018
7 1357
7 2035
7 2713
7 4069
12 62
12 104
15 17
15 18
15 35
15 69
15 137
15 174
15 273
15 347
15 693
15 1385
15 2769
15 2942
16 20...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

5
510318082834167951

output:

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

input:

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

output:

6
5000 2540
1 4
2 3
2 6
2 11
2 26
2 51
2 752
2 1503
2 3756
4 7
4 13
4 68
4 135
4 202
4 269
4 403
4 805
8 9
8 15
8 29
8 57
10 19
12 21
14 23
14 30
14 38
14 59
14 75
14 320
14 408
14 639
14 815
14 1074
14 2147
16 17
16 25
16 33
16 49
16 65
16 97
16 129
16 193
16 385
18 72
18 143
22 31
22 36
22 43
22 7...

input:

6
5000 2540
1 4
2 3
2 6
2 11
2 26
2 51
2 752
2 1503
2 3756
4 7
4 13
4 68
4 135
4 202
4 269
4 403
4 805
8 9
8 15
8 29
8 57
10 19
12 21
14 23
14 30
14 38
14 59
14 75
14 320
14 408
14 639
14 815
14 1074
14 2147
16 17
16 25
16 33
16 49
16 65
16 97
16 129
16 193
16 385
18 72
18 143
22 31
22 36
22 43
22 7...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

5
914858813253258744

output:

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

input:

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

output:

6
5000 2542
1 2
3 12
3 23
3 978
3 1955
4 8
4 22
4 50
4 148
5 6
5 11
5 18
5 21
5 35
5 69
5 86
5 171
5 341
7 10
7 19
7 28
7 55
7 1104
7 2207
7 3310
9 17
9 24
9 42
9 47
9 62
9 83
9 93
9 123
9 165
9 185
9 228
9 245
9 329
9 369
9 450
9 455
9 489
9 522
9 657
9 899
9 909
9 944
9 977
9 1043
9 1404
9 1797
9 ...

input:

6
5000 2542
1 2
3 12
3 23
3 978
3 1955
4 8
4 22
4 50
4 148
5 6
5 11
5 18
5 21
5 35
5 69
5 86
5 171
5 341
7 10
7 19
7 28
7 55
7 1104
7 2207
7 3310
9 17
9 24
9 42
9 47
9 62
9 83
9 93
9 123
9 165
9 185
9 228
9 245
9 329
9 369
9 450
9 455
9 489
9 522
9 657
9 899
9 909
9 944
9 977
9 1043
9 1404
9 1797
9 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

5
659635316746638238

output:

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

input:

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

output:

6
5000 2528
1 3
2 4
2 10
2 24
2 70
2 208
2 350
2 1010
2 1048
2 3028
2 3142
3 174
3 347
3 693
5 7
6 1374
6 2384
7 9
7 12
7 14
7 15
7 23
7 27
7 29
7 45
7 53
7 57
7 78
7 89
7 92
7 105
7 144
7 155
7 183
7 287
7 309
7 365
7 573
7 617
7 620
7 729
7 1002
7 1145
7 1239
7 2003
7 2477
7 4005
7 4334
7 4953
11 ...

input:

6
5000 2528
1 3
2 4
2 10
2 24
2 70
2 208
2 350
2 1010
2 1048
2 3028
2 3142
3 174
3 347
3 693
5 7
6 1374
6 2384
7 9
7 12
7 14
7 15
7 23
7 27
7 29
7 45
7 53
7 57
7 78
7 89
7 92
7 105
7 144
7 155
7 183
7 287
7 309
7 365
7 573
7 617
7 620
7 729
7 1002
7 1145
7 1239
7 2003
7 2477
7 4005
7 4334
7 4953
11 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1804kb,1800kb

input:

7
858490260563149759

output:

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

input:

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

output:

8
5000 2500
5 4864
6 719
7 72
7 498
7 782
7 4190
11 48
11 424
11 964
11 1318
11 3952
13 2714
15 18
18 23
22 1635
22 3288
25 90
25 446
25 1322
27 1014
29 82
29 1090
29 3268
31 68
34 399
35 526
36 1319
36 2637
38 363
38 1087
38 3259
41 454
41 2870
44 278
44 555
44 1109
44 1382
44 1663
44 2763
44 3325
...

input:

8
5000 2500
5 4864
6 719
7 72
7 498
7 782
7 4190
11 48
11 424
11 964
11 1318
11 3952
13 2714
15 18
18 23
22 1635
22 3288
25 90
25 446
25 1322
27 1014
29 82
29 1090
29 3268
31 68
34 399
35 526
36 1319
36 2637
38 363
38 1087
38 3259
41 454
41 2870
44 278
44 555
44 1109
44 1382
44 1663
44 2763
44 3325
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1800kb,1804kb

input:

7
860058643727731209

output:

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

input:

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

output:

8
5000 2500
3 2888
5 20
8 1815
8 2238
8 4475
9 812
12 440
12 879
14 29
14 2259
14 4517
15 660
15 3296
16 19
17 390
21 54
21 372
23 4272
24 39
24 410
24 647
24 1434
24 2867
27 2802
32 563
34 73
37 1948
38 1322
38 1503
38 2643
38 3005
41 90
41 462
42 113
42 225
42 380
42 759
42 1517
42 3033
43 514
44 ...

input:

8
5000 2500
3 2888
5 20
8 1815
8 2238
8 4475
9 812
12 440
12 879
14 29
14 2259
14 4517
15 660
15 3296
16 19
17 390
21 54
21 372
23 4272
24 39
24 410
24 647
24 1434
24 2867
27 2802
32 563
34 73
37 1948
38 1322
38 1503
38 2643
38 3005
41 90
41 462
42 113
42 225
42 380
42 759
42 1517
42 3033
43 514
44 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

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

input:

7
718861404514377808

output:

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

input:

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

output:

8
5000 2500
2 788
3 12
3 1112
3 2223
6 140
6 974
8 368
8 1102
10 1544
11 19
15 80
15 108
15 159
21 44
21 87
21 147
21 3140
25 89
27 722
27 1443
28 72
30 3384
31 2067
32 164
33 2673
33 3000
34 36
34 176
35 40
35 79
38 82
38 504
38 4528
39 471
40 54
42 114
42 420
50 2074
50 3094
52 2418
54 206
54 3170...

input:

8
5000 2500
2 788
3 12
3 1112
3 2223
6 140
6 974
8 368
8 1102
10 1544
11 19
15 80
15 108
15 159
21 44
21 87
21 147
21 3140
25 89
27 722
27 1443
28 72
30 3384
31 2067
32 164
33 2673
33 3000
34 36
34 176
35 40
35 79
38 82
38 504
38 4528
39 471
40 54
42 114
42 420
50 2074
50 3094
52 2418
54 206
54 3170...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

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

input:

7
659192688464047828

output:

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

input:

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

output:

8
5000 2500
4 3426
6 72
6 444
6 2310
9 1734
9 3467
11 2992
12 450
15 1434
15 2867
16 1400
17 19
17 28
17 55
18 20
20 2694
24 678
24 1872
24 3386
25 1760
25 3519
25 4640
26 118
26 508
26 2198
27 615
30 38
33 522
33 2085
36 108
36 654
38 282
38 844
42 50
42 1560
42 3558
43 3555
44 1746
44 2838
44 3142...

input:

8
5000 2500
4 3426
6 72
6 444
6 2310
9 1734
9 3467
11 2992
12 450
15 1434
15 2867
16 1400
17 19
17 28
17 55
18 20
20 2694
24 678
24 1872
24 3386
25 1760
25 3519
25 4640
26 118
26 508
26 2198
27 615
30 38
33 522
33 2085
36 108
36 654
38 282
38 844
42 50
42 1560
42 3558
43 3555
44 1746
44 2838
44 3142...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

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

input:

7
685730986714800201

output:

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

input:

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

output:

8
5000 2500
3 282
4 19
5 80
6 152
6 605
6 3743
9 132
11 12
14 39
17 4490
20 27
20 198
20 395
24 2907
24 2964
26 3770
28 1298
28 2595
29 2318
31 262
33 144
37 490
37 816
37 2446
38 125
43 2284
44 122
44 3182
47 3072
48 719
49 922
49 2764
50 1919
51 108
54 597
55 62
55 184
55 1728
56 95
57 446
57 624
...

input:

8
5000 2500
3 282
4 19
5 80
6 152
6 605
6 3743
9 132
11 12
14 39
17 4490
20 27
20 198
20 395
24 2907
24 2964
26 3770
28 1298
28 2595
29 2318
31 262
33 144
37 490
37 816
37 2446
38 125
43 2284
44 122
44 3182
47 3072
48 719
49 922
49 2764
50 1919
51 108
54 597
55 62
55 184
55 1728
56 95
57 446
57 624
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201