QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535494#8726. Magic ShowWansur100 ✓205ms19924kbC++231.0kb2024-08-28 05:56:322024-08-28 05:56:33

Judging History

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

  • [2024-08-28 05:56:33]
  • 评测
  • 测评结果:100
  • 用时:205ms
  • 内存:19924kb
  • [2024-08-28 05:56:32]
  • 提交

Alice

#include "Alice.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

mt19937 rng(92783458);

int p[5001];

int get(int x){
    if(p[x] == x) return x;
    return p[x] = get(p[x]);
}

vector<pair<int,int>> Alice(){
    vector<pair<int, int>> edge, ans;
    int n = 5000;
    ll x = setN(n);
    for(int i=1;i<=n;i++){
        p[i] = i;
    }
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            if((x & (1ll << ((i + j) % 60)))){
                edge.push_back({i, j});
            }
        }
    }
    shuffle(edge.begin(), edge.end(), rng);
    for(auto [x, y]:edge){
        if(get(x) != get(y)){
            ans.push_back({x, y});
            p[get(x)] = get(y);
        }
    }
    return ans;
}

Bob

#include <bits/stdc++.h>
#include "Bob.h"

using namespace std;
typedef long long ll;

long long Bob(std::vector<std::pair<int,int>> edge){
    ll ans = 0;
    for(auto [x, y]:edge){
        ans |= (1ll << ((x + y) % 60));
    }
    return ans;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

1
4005

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
4569 4971
901 2404
185 4135
3862 4005
2807 3504
3108 3374
1471 3338
3929 4951
1991 4377
3580 4290
1790 3200
596 2055
2822 3658
54 1328
2278 4989
2532 4558
1092 4917...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
4569 4971
901 2404
185 4135
3862 4005
2807 3504
3108 3374
1471 3338
3929 4951
1991 4377
3580 4290
1790 3200
596 2055
2822 3658
54 1328
2278 4989
2532 4558
1092 4917...

output:

2
5000 4418
1 121
1 3908
2 4449
3 608
3 787
3 904
3 4568
4 2226
5 604
6 1862
7 63
8 1501
9 1133
9 4982
10 1319
10 4198
10 4560
11 3411
11 4678
12 4548
13 1138
14 597
14 1494
15 1545
16 3712
17 291
17 1905
17 4845
18 950
18 2870
19 1001
19 1490
19 2690
20 1311
21 3170
21 3281
22 1427
23 97
23 279
24 ...

input:

2
5000 4418
1 121
1 3908
2 4449
3 608
3 787
3 904
3 4568
4 2226
5 604
6 1862
7 63
8 1501
9 1133
9 4982
10 1319
10 4198
10 4560
11 3411
11 4678
12 4548
13 1138
14 597
14 1494
15 1545
16 3712
17 291
17 1905
17 4845
18 950
18 2870
19 1001
19 1490
19 2690
20 1311
21 3170
21 3281
22 1427
23 97
23 279
24 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

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

input:

1
459

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
230 3073
1249 2418
249 474
2994 3973
3015 3346
2920 4703
2124 2797
1000 2247
3067 3241
839 3784
2674 4827
813 2974
825 1462
72 475
3758 3930
3582 3801
1532 3515
237...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
230 3073
1249 2418
249 474
2994 3973
3015 3346
2920 4703
2124 2797
1000 2247
3067 3241
839 3784
2674 4827
813 2974
825 1462
72 475
3758 3930
3582 3801
1532 3515
237...

output:

2
5000 4418
1 127
2 238
3 1317
3 2644
3 4205
3 4444
3 4565
4 4504
5 3063
5 3955
6 1494
6 2580
9 231
9 531
10 1078
10 3776
11 4915
13 115
13 1855
14 713
14 1126
14 2926
14 4366
15 1311
15 3046
16 4487
17 1664
18 2208
18 2745
18 3765
19 48
19 1844
19 3287
20 467
21 2506
22 2086
22 2145
22 4299
23 2737...

input:

2
5000 4418
1 127
2 238
3 1317
3 2644
3 4205
3 4444
3 4565
4 4504
5 3063
5 3955
6 1494
6 2580
9 231
9 531
10 1078
10 3776
11 4915
13 115
13 1855
14 713
14 1126
14 2926
14 4366
15 1311
15 3046
16 4487
17 1664
18 2208
18 2745
18 3765
19 48
19 1844
19 3287
20 467
21 2506
22 2086
22 2145
22 4299
23 2737...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

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

input:

1
2495

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
3285 3986
791 4192
165 320
3018 3522
2344 3960
3490 4617
3344 4637
3052 3551
1710 3458
2862 4705
1545 3440
526 2001
2355 4496
48 1760
1940 4727
2138 4227
957 1267
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
3285 3986
791 4192
165 320
3018 3522
2344 3960
3490 4617
3344 4637
3052 3551
1710 3458
2862 4705
1545 3440
526 2001
2355 4496
48 1760
1940 4727
2138 4227
957 1267
1...

output:

2
5000 4418
1 1923
2 3425
2 4625
2 4739
3 3425
4 363
4 3360
6 1794
7 900
7 2513
8 2099
9 1202
9 3775
9 4131
10 2513
10 3654
11 2940
12 3353
13 1192
13 3595
14 294
15 1426
15 2813
16 467
16 1431
17 1368
18 653
19 1783
19 2982
19 4661
20 2867
20 3044
21 2146
22 2569
22 3761
22 4960
23 3817
24 1304
25 ...

input:

2
5000 4418
1 1923
2 3425
2 4625
2 4739
3 3425
4 363
4 3360
6 1794
7 900
7 2513
8 2099
9 1202
9 3775
9 4131
10 2513
10 3654
11 2940
12 3353
13 1192
13 3595
14 294
15 1426
15 2813
16 467
16 1431
17 1368
18 653
19 1783
19 2982
19 4661
20 2867
20 3044
21 2146
22 2569
22 3761
22 4960
23 3817
24 1304
25 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

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

input:

3
1560

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
349 3194
2066 2323
378 592
841 4862
1514 2636
3861 4542
2331 2478
1608 3615
1669 4394
1330 2154
1468 3935
1285 4298
1305 3018
108 442
879 3871
2879 4805
2646 3237
7...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
349 3194
2066 2323
378 592
841 4862
1514 2636
3861 4542
2331 2478
1608 3615
1669 4394
1330 2154
1468 3935
1285 4298
1305 3018
108 442
879 3871
2879 4805
2646 3237
7...

output:

4
5000 2500
1 189
1 4323
2 2822
3 1326
4 2406
4 3960
6 4263
7 4616
8 896
8 4676
9 1374
9 4074
11 3839
11 4679
19 170
19 2804
21 4003
24 3526
24 4186
25 3459
26 458
27 1597
28 4901
31 3753
31 4113
32 2612
32 4177
34 4895
36 507
37 2367
40 4583
41 4462
44 140
45 3859
46 1697
46 2303
48 3142
49 2955
49...

input:

4
5000 2500
1 189
1 4323
2 2822
3 1326
4 2406
4 3960
6 4263
7 4616
8 896
8 4676
9 1374
9 4074
11 3839
11 4679
19 170
19 2804
21 4003
24 3526
24 4186
25 3459
26 458
27 1597
28 4901
31 3753
31 4113
32 2612
32 4177
34 4895
36 507
37 2367
40 4583
41 4462
44 140
45 3859
46 1697
46 2303
48 3142
49 2955
49...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

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

input:

3
3594

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
277 3874
1552 3671
300 1211
3472 3679
1163 3160
4559 4804
2780 2929
1231 3520
1275 3356
1028 3182
3778 4332
995 3635
1010 1991
86 2075
689 2982
2068 2913
1928 4975
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
277 3874
1552 3671
300 1211
3472 3679
1163 3160
4559 4804
2780 2929
1231 3520
1275 3356
1028 3182
3778 4332
995 3635
1010 1991
86 2075
689 2982
2068 2913
1928 4975
...

output:

4
5000 2500
3 3540
3 3958
5 3365
5 4146
6 3663
8 895
11 118
11 4852
12 3477
13 1258
19 4910
20 343
20 2923
21 1720
21 4600
24 457
25 2616
25 2976
27 1114
29 692
30 639
32 4178
32 4291
33 3157
35 1654
36 1355
36 1655
38 2845
40 1761
40 3331
41 1469
42 4888
43 1518
44 1939
44 3499
46 3444
47 1582
50 3...

input:

4
5000 2500
3 3540
3 3958
5 3365
5 4146
6 3663
8 895
11 118
11 4852
12 3477
13 1258
19 4910
20 343
20 2923
21 1720
21 4600
24 457
25 2616
25 2976
27 1114
29 692
30 639
32 4178
32 4291
33 3157
35 1654
36 1355
36 1655
38 2845
40 1761
40 3331
41 1469
42 4888
43 1518
44 1939
44 3499
46 3444
47 1582
50 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

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

input:

3
1750

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
197 533
1046 3883
212 4169
2350 4974
3612 4198
4277 4969
1735 2834
842 3965
2397 4393
3498 4791
2135 4595
688 939
3640 4106
61 4266
2788 3514
3159 4890
1275 1487
19...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
197 533
1046 3883
212 4169
2350 4974
3612 4198
4277 4969
1735 2834
842 3965
2397 4393
3498 4791
2135 4595
688 939
3640 4106
61 4266
2788 3514
3159 4890
1275 1487
19...

output:

4
5000 2500
1 125
1 4500
2 1499
2 4682
4 4742
5 2642
6 1804
8 4442
8 4736
10 2037
11 1496
11 2995
14 3108
14 4916
17 1790
20 3284
21 4008
21 4606
23 161
23 1844
24 3097
26 3935
26 4063
28 3336
28 3454
29 220
29 1361
30 3937
30 4537
32 4592
33 4954
38 3632
41 2789
41 4825
44 2180
44 2597
45 136
46 15...

input:

4
5000 2500
1 125
1 4500
2 1499
2 4682
4 4742
5 2642
6 1804
8 4442
8 4736
10 2037
11 1496
11 2995
14 3108
14 4916
17 1790
20 3284
21 4008
21 4606
23 161
23 1844
24 3097
26 3935
26 4063
28 3336
28 3454
29 220
29 1361
30 3937
30 4537
32 4592
33 4954
38 3632
41 2789
41 4825
44 2180
44 2597
45 136
46 15...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

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

input:

5
4878

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
230 3072
1249 2414
249 420
2994 3978
3015 3293
2920 4592
2124 2744
1000 2182
3067 3235
839 3789
2674 4718
813 2916
825 1403
72 469
3758 3865
3582 3740
1532 3460
237...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
230 3072
1249 2414
249 420
2994 3978
3015 3293
2920 4592
2124 2744
1000 2182
3067 3235
839 3789
2674 4718
813 2916
825 1403
72 469
3758 3865
3582 3740
1532 3460
237...

output:

6
5000 2502
2 239
3 2645
4 4499
5 1376
5 3898
6 4326
7 1315
8 4444
9 174
9 423
10 3722
11 4861
13 109
13 4676
14 707
14 1069
14 1189
14 2869
15 1257
16 4433
17 1611
18 2564
18 2691
19 42
21 2200
22 4246
23 4660
24 1065
25 2077
26 1362
26 3516
27 2735
28 2744
30 2078
30 2442
31 3572
31 4711
32 570
33...

input:

6
5000 2502
2 239
3 2645
4 4499
5 1376
5 3898
6 4326
7 1315
8 4444
9 174
9 423
10 3722
11 4861
13 109
13 4676
14 707
14 1069
14 1189
14 2869
15 1257
16 4433
17 1611
18 2564
18 2691
19 42
21 2200
22 4246
23 4660
24 1065
25 2077
26 1362
26 3516
27 2735
28 2744
30 2078
30 2442
31 3572
31 4711
32 570
33...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

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

input:

5
1223

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
230 3130
1249 2651
249 531
2994 4506
3015 3831
2921 3140
2124 3156
1000 2422
3067 3775
839 3908
2675 2971
813 3147
825 1582
72 478
3758 4583
3582 4399
1532 3808
237...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
230 3130
1249 2651
249 531
2994 4506
3015 3831
2921 3140
2124 3156
1000 2422
3067 3775
839 3908
2675 2971
813 3147
825 1582
72 478
3758 4583
3582 4399
1532 3808
237...

output:

6
5000 2500
3 2647
3 4257
3 4617
5 3065
6 2580
8 952
9 231
9 1373
10 1080
11 4915
12 3348
14 4366
15 3046
16 4486
18 2572
19 3287
20 467
21 2506
22 2088
22 4299
23 3223
24 1118
25 2085
26 824
28 2682
29 2977
31 691
33 3689
35 4715
36 3566
38 1588
39 2901
41 1219
41 2365
41 4041
42 2899
43 4824
44 20...

input:

6
5000 2500
3 2647
3 4257
3 4617
5 3065
6 2580
8 952
9 231
9 1373
10 1080
11 4915
12 3348
14 4366
15 3046
16 4486
18 2572
19 3287
20 467
21 2506
22 2088
22 4299
23 3223
24 1118
25 2085
26 824
28 2682
29 2977
31 691
33 3689
35 4715
36 3566
38 1588
39 2901
41 1219
41 2365
41 4041
42 2899
43 4824
44 20...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

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

input:

5
648

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
471 3552
3225 3504
510 3633
1162 4547
2194 2853
4000 4527
3916 4793
2352 3715
2458 3129
1897 2132
2119 2688
1827 2980
1857 4932
144 945
1217 3112
4615 4694
3212 363...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
471 3552
3225 3504
510 3633
1162 4547
2194 2853
4000 4527
3916 4793
2352 3715
2458 3129
1897 2132
2119 2688
1827 2980
1857 4932
144 945
1217 3112
4615 4694
3212 363...

output:

6
5000 2500
1 302
2 727
3 420
5 2582
6 123
6 303
6 1681
6 2583
6 3477
6 3903
7 3902
8 295
8 1261
9 414
10 1193
11 2936
12 175
12 3775
12 4555
13 710
15 2988
17 1010
18 2389
19 4604
20 2567
21 2208
23 4184
25 1604
26 4483
27 2200
28 819
28 3575
28 3699
28 3821
29 2618
30 1059
31 1712
32 3995
33 3334
...

input:

6
5000 2500
1 302
2 727
3 420
5 2582
6 123
6 303
6 1681
6 2583
6 3477
6 3903
7 3902
8 295
8 1261
9 414
10 1193
11 2936
12 175
12 3775
12 4555
13 710
15 2988
17 1010
18 2389
19 4604
20 2567
21 2208
23 4184
25 1604
26 4483
27 2200
28 819
28 3575
28 3699
28 3821
29 2618
30 1059
31 1712
32 3995
33 3334
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

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

input:

7
4475

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
4571 4733
901 2520
185 4198
3862 4541
2807 3916
3108 3744
1471 3574
3930 4411
1991 4674
3580 4832
1790 3434
596 2165
2822 4019
54 1329
2279 2522
2532 4920
1093 1195...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
4571 4733
901 2520
185 4198
3862 4541
2807 3916
3108 3744
1471 3574
3930 4411
1991 4674
3580 4832
1790 3434
596 2165
2822 4019
54 1329
2279 2522
2532 4920
1093 1195...

output:

8
5000 2500
1 120
1 3905
3 957
4 2282
7 119
7 353
10 1375
11 2810
11 3469
12 4560
14 654
14 3832
16 3768
17 347
17 1963
17 4903
18 1006
19 1546
19 2746
20 1368
21 3339
22 2203
23 109
23 337
24 1004
25 1058
25 3700
26 4420
27 1353
28 4484
28 4597
30 330
31 455
31 2610
33 635
33 987
34 2009
34 4231
35...

input:

8
5000 2500
1 120
1 3905
3 957
4 2282
7 119
7 353
10 1375
11 2810
11 3469
12 4560
14 654
14 3832
16 3768
17 347
17 1963
17 4903
18 1006
19 1546
19 2746
20 1368
21 3339
22 2203
23 109
23 337
24 1004
25 1058
25 3700
26 4420
27 1353
28 4484
28 4597
30 330
31 455
31 2610
33 635
33 987
34 2009
34 4231
35...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

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

input:

7
4240

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
471 3853
3226 3861
510 3934
1163 1481
2194 4290
4003 4229
3919 4133
2353 2631
2458 4754
1897 3335
2119 4068
1827 4177
1858 3009
144 1008
1217 3895
4622 4865
3213 39...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
471 3853
3226 3861
510 3934
1163 1481
2194 4290
4003 4229
3919 4133
2353 2631
2458 4754
1897 3335
2119 4068
1827 4177
1858 3009
144 1008
1217 3895
4622 4865
3213 39...

output:

8
5000 2500
1 303
2 4745
4 3963
7 3065
7 3417
8 244
8 4024
9 363
10 2874
13 2639
14 418
15 297
15 597
16 4008
19 1493
20 587
21 2206
21 3826
23 3401
23 4181
24 4788
25 227
25 3707
29 1783
30 1057
30 3697
31 1661
31 4116
32 3095
33 3331
34 2370
34 4653
36 336
36 636
36 2676
37 867
38 3686
39 1288
41 ...

input:

8
5000 2500
1 303
2 4745
4 3963
7 3065
7 3417
8 244
8 4024
9 363
10 2874
13 2639
14 418
15 297
15 597
16 4008
19 1493
20 587
21 2206
21 3826
23 3401
23 4181
24 4788
25 227
25 3707
29 1783
30 1057
30 3697
31 1661
31 4116
32 3095
33 3331
34 2370
34 4653
36 336
36 636
36 2676
37 867
38 3686
39 1288
41 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

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

input:

7
1291

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
277 4163
1552 4271
300 1330
3473 3497
1163 3697
4563 4798
2780 4120
1231 4112
1275 3948
1028 3660
3779 4569
995 4173
1010 2360
86 2142
689 3334
2068 3762
1929 2752
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
277 4163
1552 4271
300 1330
3473 3497
1163 3697
4563 4798
2780 4120
1231 4112
1275 3948
1028 3660
3779 4569
995 4173
1010 2360
86 2142
689 3334
2068 3762
1929 2752
...

output:

8
5000 2500
1 182
2 1266
5 175
5 3425
7 1793
11 177
12 348
12 3536
13 1367
14 946
15 2153
16 3884
17 1491
17 2871
19 4969
20 2983
21 4660
22 1539
22 3048
24 36
24 3696
25 2676
25 3036
30 700
32 4408
33 4597
34 2554
34 4409
35 3388
38 1102
39 4169
39 4342
41 1639
42 2778
43 80
44 3616
45 3975
45 4103...

input:

8
5000 2500
1 182
2 1266
5 175
5 3425
7 1793
11 177
12 348
12 3536
13 1367
14 946
15 2153
16 3884
17 1491
17 2871
19 4969
20 2983
21 4660
22 1539
22 3048
24 36
24 3696
25 2676
25 3036
30 700
32 4408
33 4597
34 2554
34 4409
35 3388
38 1102
39 4169
39 4342
41 1639
42 2778
43 80
44 3616
45 3975
45 4103...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 44ms = 44ms + 0ms

input:

1
17476204

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
2363 4120
3709 4160
134 3535
2214 4511
1788 3858
2468 3958
2394 4943
2234 3235
1339 4074
2122 2623
1217 2522
426 1385
1796 2361
39 3154
1507 1555
1646 4733
767 1346...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
2363 4120
3709 4160
134 3535
2214 4511
1788 3858
2468 3958
2394 4943
2234 3235
1339 4074
2122 2623
1217 2522
426 1385
1796 2361
39 3154
1507 1555
1646 4733
767 1346...

output:

2
5000 4418
1 1568
1 4141
2 1871
2 2842
2 2941
3 2528
3 4982
4 4501
5 1804
5 1934
6 1449
7 2635
7 3552
8 661
8 916
8 3714
8 4627
9 3135
10 2575
10 3189
10 4865
11 3238
12 3234
12 4383
13 1553
13 2342
14 2271
14 4908
15 542
16 3481
17 48
18 2821
18 4784
19 4970
20 702
21 1361
21 4730
22 473
22 4847
2...

input:

2
5000 4418
1 1568
1 4141
2 1871
2 2842
2 2941
3 2528
3 4982
4 4501
5 1804
5 1934
6 1449
7 2635
7 3552
8 661
8 916
8 3714
8 4627
9 3135
10 2575
10 3189
10 4865
11 3238
12 3234
12 4383
13 1553
13 2342
14 2271
14 4908
15 542
16 3481
17 48
18 2821
18 4784
19 4970
20 702
21 1361
21 4730
22 473
22 4847
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 48ms = 48ms + 0ms

input:

1
11926600

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1881 3651
2708 2948
3990 4426
1773 4479
1454 3182
1956 1962
1903 4649
1788 2655
1103 4140
3399 4893
1006 1527
358 1814
1460 2452
33 3108
1235 4777
1345 2148
640 267...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1881 3651
2708 2948
3990 4426
1773 4479
1454 3182
1956 1962
1903 4649
1788 2655
1103 4140
3399 4893
1006 1527
358 1814
1460 2452
33 3108
1235 4777
1345 2148
640 267...

output:

2
5000 4914
1 3491
1 4522
2 794
2 1632
2 1692
3 557
3 2648
3 4380
4 1448
4 3422
4 3546
5 1089
5 3378
6 3314
7 73
7 309
7 2649
7 3434
8 1435
8 3850
9 132
9 2104
9 3423
10 4146
11 2642
11 3835
12 1074
12 1801
12 4022
13 4080
14 2467
15 4199
16 842
17 538
18 592
18 2333
18 3485
19 2821
19 3587
19 3773
...

input:

2
5000 4914
1 3491
1 4522
2 794
2 1632
2 1692
3 557
3 2648
3 4380
4 1448
4 3422
4 3546
5 1089
5 3378
6 3314
7 73
7 309
7 2649
7 3434
8 1435
8 3850
9 132
9 2104
9 3423
10 4146
11 2642
11 3835
12 1074
12 1801
12 4022
13 4080
14 2467
15 4199
16 842
17 538
18 592
18 2333
18 3485
19 2821
19 3587
19 3773
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 54ms = 54ms + 0ms

input:

1
16602378

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1881 3778
2708 3182
3990 4729
1773 4606
1454 3300
1956 2138
1903 4769
1788 2731
1103 4247
3400 3570
1006 1575
358 1818
1460 2563
33 3110
1235 4888
1345 2256
640 272...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1881 3778
2708 3182
3990 4729
1773 4606
1454 3300
1956 2138
1903 4769
1788 2731
1103 4247
3400 3570
1006 1575
358 1818
1460 2563
33 3110
1235 4888
1345 2256
640 272...

output:

2
5000 4914
1 3493
2 800
2 1638
2 1698
3 598
3 2653
3 4387
4 1455
4 3430
5 3427
6 3362
7 116
7 316
7 2656
7 3481
8 1440
9 133
9 2105
10 4148
11 2641
11 3830
12 1069
12 1800
12 4022
13 4079
14 245
14 2467
15 428
15 4199
16 843
16 4372
17 539
18 585
18 3484
19 2821
19 3582
20 2642
20 3710
21 2393
21 3...

input:

2
5000 4914
1 3493
2 800
2 1638
2 1698
3 598
3 2653
3 4387
4 1455
4 3430
5 3427
6 3362
7 116
7 316
7 2656
7 3481
8 1440
9 133
9 2105
10 4148
11 2641
11 3830
12 1069
12 1800
12 4022
13 4079
14 245
14 2467
15 428
15 4199
16 843
16 4372
17 539
18 585
18 3484
19 2821
19 3582
20 2642
20 3710
21 2393
21 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 47ms = 47ms + 0ms

input:

3
13129243

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
2363 4778
3710 3864
134 3590
2215 2288
1788 4336
2468 4672
2395 2957
2234 3848
1339 4444
2122 3219
1217 2877
426 1516
1796 2834
39 3211
1507 1982
1647 1845
767 1536...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
2363 4778
3710 3864
134 3590
2215 2288
1788 4336
2468 4672
2395 2957
2234 3848
1339 4444
2122 3219
1217 2877
426 1516
1796 2834
39 3211
1507 1982
1647 1845
767 1536...

output:

4
5000 2500
1 4140
3 2539
3 4989
4 4506
5 1814
5 1978
6 1495
6 3055
7 3602
9 3180
10 4910
11 3248
12 4428
15 586
17 55
19 4980
22 4857
27 453
27 4177
28 164
30 93
30 4124
31 4128
32 1127
32 4891
33 1471
33 1781
34 4175
37 87
39 3211
40 89
40 443
41 4039
42 2132
42 4961
44 3938
45 1275
49 3672
50 326...

input:

4
5000 2500
1 4140
3 2539
3 4989
4 4506
5 1814
5 1978
6 1495
6 3055
7 3602
9 3180
10 4910
11 3248
12 4428
15 586
17 55
19 4980
22 4857
27 453
27 4177
28 164
30 93
30 4124
31 4128
32 1127
32 4891
33 1471
33 1781
34 4175
37 87
39 3211
40 89
40 443
41 4039
42 2132
42 4961
44 3938
45 1275
49 3672
50 326...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 46ms = 46ms + 0ms

input:

3
7892141

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1881 3581
2708 2819
3990 4190
1773 4427
1454 3128
1956 1957
1903 4639
1788 2592
1103 4136
3399 4771
1006 1534
358 1761
1460 2394
33 3220
1235 4787
1345 2096
640 278...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1881 3581
2708 2819
3990 4190
1773 4427
1454 3128
1956 1957
1903 4639
1788 2592
1103 4136
3399 4771
1006 1534
358 1761
1460 2394
33 3220
1235 4787
1345 2096
640 278...

output:

4
5000 2500
1 3490
6 3374
8 3913
9 193
9 2162
10 4209
11 2702
11 3894
13 4140
14 2566
15 4259
16 905
19 2883
19 3646
21 2453
23 3467
24 2698
25 1362
27 2018
28 4957
29 2993
29 3331
34 4240
35 2327
35 4907
36 4415
37 4904
38 1889
40 822
41 1961
42 4778
43 2547
44 439
45 1895
46 2725
47 2483
47 4714
4...

input:

4
5000 2500
1 3490
6 3374
8 3913
9 193
9 2162
10 4209
11 2702
11 3894
13 4140
14 2566
15 4259
16 905
19 2883
19 3646
21 2453
23 3467
24 2698
25 1362
27 2018
28 4957
29 2993
29 3331
34 4240
35 2327
35 4907
36 4415
37 4904
38 1889
40 822
41 1961
42 4778
43 2547
44 439
45 1895
46 2725
47 2483
47 4714
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 56ms = 56ms + 0ms

input:

3
21314775

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1711 3330
2419 2508
3348 3374
1616 3148
1331 3551
1776 4837
1731 2371
1629 1867
1015 1035
2960 3304
4174 4472
331 4311
1336 4306
31 1589
1134 4157
1233 2499
591 421...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1711 3330
2419 2508
3348 3374
1616 3148
1331 3551
1776 4837
1731 2371
1629 1867
1015 1035
2960 3304
4174 4472
331 4311
1336 4306
31 1589
1134 4157
1233 2499
591 421...

output:

4
5000 2500
1 2409
3 2530
3 3368
5 3739
6 3012
6 3241
8 4194
9 1813
13 2754
16 4548
20 3236
21 2446
22 4502
23 2681
24 2143
25 2617
27 2811
27 3104
30 2312
31 1589
32 3464
34 3152
35 1709
36 2244
36 4897
40 4718
40 4904
43 1415
43 4041
44 2314
44 3802
45 3375
48 4116
49 1331
51 1029
51 3801
52 1758
...

input:

4
5000 2500
1 2409
3 2530
3 3368
5 3739
6 3012
6 3241
8 4194
9 1813
13 2754
16 4548
20 3236
21 2446
22 4502
23 2681
24 2143
25 2617
27 2811
27 3104
30 2312
31 1589
32 3464
34 3152
35 1709
36 2244
36 4897
40 4718
40 4904
43 1415
43 4041
44 2314
44 3802
45 3375
48 4116
49 1331
51 1029
51 3801
52 1758
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 51ms = 51ms + 0ms

input:

5
5559540

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
2092 4870
3100 4886
123 2231
1968 2846
1603 4169
2179 4063
2118 4366
1984 4158
1210 2048
4169 4653
1101 3419
389 1791
1610 2724
36 1950
1357 4365
1480 3152
698 1124...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
2092 4870
3100 4886
123 2231
1968 2846
1603 4169
2179 4063
2118 4366
1984 4158
1210 2048
4169 4653
1101 3419
389 1791
1610 2724
36 1950
1357 4365
1480 3152
698 1124...

output:

6
5000 2526
1 3785
2 1280
2 2280
2 3363
3 4622
4 554
4 2650
4 4983
5 119
6 416
7 775
8 476
8 1322
9 4151
10 1196
11 3359
12 3418
13 1627
13 4069
14 4508
15 785
17 2275
19 2811
20 1006
21 703
21 1489
22 2140
23 4612
24 4498
27 1477
28 1666
29 1245
30 1488
31 4961
33 1662
33 1669
33 1782
33 2869
38 46...

input:

6
5000 2526
1 3785
2 1280
2 2280
2 3363
3 4622
4 554
4 2650
4 4983
5 119
6 416
7 775
8 476
8 1322
9 4151
10 1196
11 3359
12 3418
13 1627
13 4069
14 4508
15 785
17 2275
19 2811
20 1006
21 703
21 1489
22 2140
23 4612
24 4498
27 1477
28 1666
29 1245
30 1488
31 4961
33 1662
33 1669
33 1782
33 2869
38 46...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 62ms = 62ms + 0ms

input:

5
9424319

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
3782 4021
1854 2408
2419 3761
3647 4035
3342 3701
1399 2224
1365 2955
4217 4913
818 1162
4081 4334
2770 3009
271 3886
1067 4831
25 4734
911 3712
988 1788
3039 3749
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
3782 4021
1854 2408
2419 3761
3647 4035
3342 3701
1399 2224
1365 2955
4217 4913
818 1162
4081 4334
2770 3009
271 3886
1067 4831
25 4734
911 3712
988 1788
3039 3749
...

output:

6
5000 2512
2 126
3 2595
5 3063
6 2890
7 731
7 2229
7 4391
9 298
9 3473
10 178
11 1625
12 1789
14 473
15 4684
16 585
17 4311
21 4855
22 2019
23 4059
25 4734
27 1713
28 2802
28 3348
31 330
31 1604
32 3286
33 4358
34 4302
36 4834
37 384
38 2302
40 1654
41 4895
42 3753
43 2958
44 918
45 863
46 4097
47 ...

input:

6
5000 2512
2 126
3 2595
5 3063
6 2890
7 731
7 2229
7 4391
9 298
9 3473
10 178
11 1625
12 1789
14 473
15 4684
16 585
17 4311
21 4855
22 2019
23 4059
25 4734
27 1713
28 2802
28 3348
31 330
31 1604
32 3286
33 4358
34 4302
36 4834
37 384
38 2302
40 1654
41 4895
42 3753
43 2958
44 918
45 863
46 4097
47 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

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

input:

5
10955780

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
3285 3512
791 3907
164 4649
3018 3235
2344 3854
3490 4380
3344 4109
3052 3326
1710 3212
2862 4171
1545 2966
526 1537
2355 4256
48 1403
1940 4482
2138 3698
957 1220
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
3285 3512
791 3907
164 4649
3018 3235
2344 3854
3490 4380
3344 4109
3052 3326
1710 3212
2862 4171
1545 2966
526 1537
2355 4256
48 1403
1940 4482
2138 3698
957 1220
...

output:

6
5000 2501
2 4628
3 1280
3 3378
4 3254
5 4151
6 1757
7 2286
9 434
9 968
10 2231
11 2700
12 3851
13 3357
15 2575
16 182
17 1086
19 1498
20 42
21 1901
22 4675
23 4787
24 1066
25 3826
26 2985
27 4235
28 2870
29 1192
29 2694
31 45
32 4361
34 1124
38 3752
40 2431
41 2481
43 1598
44 939
46 4651
48 3614
5...

input:

6
5000 2501
2 4628
3 1280
3 3378
4 3254
5 4151
6 1757
7 2286
9 434
9 968
10 2231
11 2700
12 3851
13 3357
15 2575
16 182
17 1086
19 1498
20 42
21 1901
22 4675
23 4787
24 1066
25 3826
26 2985
27 4235
28 2870
29 1192
29 2694
31 45
32 4361
34 1124
38 3752
40 2431
41 2481
43 1598
44 939
46 4651
48 3614
5...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 50ms = 50ms + 0ms

input:

7
19938721

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
2363 4728
3710 3862
134 3539
2215 2290
1788 4337
2468 4622
2395 2956
2234 3833
1339 4429
2122 3169
1217 2863
426 1501
1796 2834
39 3148
1507 1933
1647 1797
767 1526...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
2363 4728
3710 3862
134 3539
2215 2290
1788 4337
2468 4622
2395 2956
2234 3833
1339 4429
2122 3169
1217 2863
426 1501
1796 2834
39 3148
1507 1933
1647 1797
767 1526...

output:

8
5000 2500
2 1869
2 2839
4 1986
5 1800
6 1445
7 2597
7 3126
7 3553
8 4624
9 3131
10 4860
11 3234
12 3228
12 4378
13 1547
13 2337
15 536
17 3363
18 2814
18 4742
19 4966
22 4843
24 404
24 1786
25 1128
26 54
27 403
28 116
29 3461
30 4110
31 4109
33 1412
33 2195
34 514
34 4113
37 1115
38 2367
38 2674
3...

input:

8
5000 2500
2 1869
2 2839
4 1986
5 1800
6 1445
7 2597
7 3126
7 3553
8 4624
9 3131
10 4860
11 3234
12 3228
12 4378
13 1547
13 2337
15 536
17 3363
18 2814
18 4742
19 4966
22 4843
24 404
24 1786
25 1128
26 54
27 403
28 116
29 3461
30 4110
31 4109
33 1412
33 2195
34 514
34 4113
37 1115
38 2367
38 2674
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

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

input:

7
5129508

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
3285 4349
791 4143
164 4774
3018 3952
2344 4393
3491 3668
3344 4950
3052 4045
1710 3635
2862 4896
1545 3393
526 1768
2355 4804
48 1471
1940 4962
2138 4244
957 1453
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
3285 4349
791 4143
164 4774
3018 3952
2344 4393
3491 3668
3344 4950
3052 4045
1710 3635
2862 4896
1545 3393
526 1768
2355 4804
48 1471
1940 4962
2138 4244
957 1453
...

output:

8
5000 2500
1 1927
2 4695
3 3376
4 3258
4 4458
5 3793
7 2335
7 3852
8 4857
9 1019
9 3550
10 1795
10 2287
10 3428
11 2754
12 2885
13 966
13 3409
15 1195
15 2627
17 1142
17 2220
18 467
20 62
20 2818
21 1921
22 2383
22 4732
23 4839
24 1118
25 3773
25 3880
26 3039
26 3936
27 4255
28 350
28 406
29 1068
3...

input:

8
5000 2500
1 1927
2 4695
3 3376
4 3258
4 4458
5 3793
7 2335
7 3852
8 4857
9 1019
9 3550
10 1795
10 2287
10 3428
11 2754
12 2885
13 966
13 3409
15 1195
15 2627
17 1142
17 2220
18 467
20 62
20 2818
21 1921
22 2383
22 4732
23 4839
24 1118
25 3773
25 3880
26 3039
26 3936
27 4255
28 350
28 406
29 1068
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 63ms = 63ms + 0ms

input:

7
15332941

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1570 4024
2192 2450
2947 2993
1485 3209
1228 1952
1629 2334
1588 2453
1496 4634
939 2624
2644 2778
3482 4081
309 547
1232 4602
29 1366
1048 4728
1138 4685
3987 4543...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1570 4024
2192 2450
2947 2993
1485 3209
1228 1952
1629 2334
1588 2453
1496 4634
939 2624
2644 2778
3482 4081
309 547
1232 4602
29 1366
1048 4728
1138 4685
3987 4543...

output:

8
5000 2500
2 21
2 799
2 4204
3 4278
4 969
4 3311
5 4270
7 4809
8 3966
9 2633
10 650
11 2819
15 4146
16 2264
19 1616
20 535
22 4248
23 4359
24 3235
25 1248
25 4136
26 4786
27 216
28 2388
29 1366
30 4233
32 1181
33 1776
34 4466
36 4464
37 1544
38 1404
38 2434
39 2013
40 2072
41 3153
42 3219
43 2419
4...

input:

8
5000 2500
2 21
2 799
2 4204
3 4278
4 969
4 3311
5 4270
7 4809
8 3966
9 2633
10 650
11 2819
15 4146
16 2264
19 1616
20 535
22 4248
23 4359
24 3235
25 1248
25 4136
26 4786
27 216
28 2388
29 1366
30 4233
32 1181
33 1776
34 4466
36 4464
37 1544
38 1404
38 2434
39 2013
40 2072
41 3153
42 3219
43 2419
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 139ms = 139ms + 0ms
memory: 3736kb,1844kb

input:

1
355365355024496523

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1411 1944
4263 4925
1057 1419
1386 2501
1679 1688
664 3369
650 1065
1996 4452
2177 4931
1457 2598
2188 4583
3146 3534
518 4021
13 4204
3143 4918
482 2961
1801 2757
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1411 1944
4263 4925
1057 1419
1386 2501
1679 1688
664 3369
650 1065
1996 4452
2177 4931
1457 2598
2188 4583
3146 3534
518 4021
13 4204
3143 4918
482 2961
1801 2757
...

output:

2
5000 4914
1 2303
1 3053
1 4194
2 8
2 1518
3 1915
4 1642
4 4423
5 791
5 2130
5 2419
6 4257
6 4903
7 3721
7 4871
8 1865
8 3882
9 1632
9 3406
10 2740
11 1944
11 3970
12 73
12 1415
12 3687
12 3697
12 3948
13 4204
14 3792
15 3459
16 3031
17 884
17 2404
18 792
19 2504
20 4448
21 1975
21 4735
22 299
22 3...

input:

2
5000 4914
1 2303
1 3053
1 4194
2 8
2 1518
3 1915
4 1642
4 4423
5 791
5 2130
5 2419
6 4257
6 4903
7 3721
7 4871
8 1865
8 3882
9 1632
9 3406
10 2740
11 1944
11 3970
12 73
12 1415
12 3687
12 3697
12 3948
13 4204
14 3792
15 3459
16 3031
17 884
17 2404
18 792
19 2504
20 4448
21 1975
21 4735
22 299
22 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 104ms = 104ms + 0ms
memory: 2800kb,1844kb

input:

1
727827999106414164

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1999 2897
2702 4474
1461 1598
1960 2562
2438 3773
899 3478
879 2398
3023 3251
3414 3495
2072 3885
3439 4642
183 2527
697 3463
17 4855
4288 4294
647 4577
2652 4854
4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1999 2897
2702 4474
1461 1598
1960 2562
2438 3773
899 3478
879 2398
3023 3251
3414 3495
2072 3885
3439 4642
183 2527
697 3463
17 4855
4288 4294
647 4577
2652 4854
4...

output:

2
5000 4708
1 3045
1 3511
2 540
2 1615
2 2047
2 2510
2 3608
3 1048
4 736
5 972
5 1987
6 660
6 2464
6 4234
6 4618
7 4005
8 1712
8 3661
8 4509
9 1952
9 4561
10 522
10 1104
10 3723
10 4651
11 1406
11 1439
12 47
12 2387
13 3109
13 3818
14 3663
15 1004
15 1352
15 2793
16 2586
17 4855
18 2984
19 929
20 20...

input:

2
5000 4708
1 3045
1 3511
2 540
2 1615
2 2047
2 2510
2 3608
3 1048
4 736
5 972
5 1987
6 660
6 2464
6 4234
6 4618
7 4005
8 1712
8 3661
8 4509
9 1952
9 4561
10 522
10 1104
10 3723
10 4651
11 1406
11 1439
12 47
12 2387
13 3109
13 3818
14 3663
15 1004
15 1352
15 2793
16 2586
17 4855
18 2984
19 929
20 20...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 89ms = 89ms + 0ms
memory: 2580kb,1844kb

input:

1
656410143989222955

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1898 3425
2543 3096
1393 4632
1862 2172
2303 4040
861 2680
842 1389
2827 4153
3161 4150
1966 3859
3182 4653
176 1815
668 3948
17 1546
3796 4174
621 1662
2498 3333
4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1898 3425
2543 3096
1393 4632
1862 2172
2303 4040
861 2680
842 1389
2827 4153
3161 4150
1966 3859
3182 4653
176 1815
668 3948
17 1546
3796 4174
621 1662
2498 3333
4...

output:

2
5000 4708
1 2929
1 3370
2 322
2 1357
2 2221
2 3273
3 612
4 126
4 4511
5 155
5 1135
5 4654
6 1394
6 3093
6 3465
7 3793
8 2151
8 2962
9 2814
9 4275
10 1810
10 2700
10 4369
10 4398
11 2865
12 123
12 253
13 626
14 141
14 3209
14 3546
14 4930
15 4544
15 4860
16 1667
17 1546
18 2373
19 3284
21 2703
22 2...

input:

2
5000 4708
1 2929
1 3370
2 322
2 1357
2 2221
2 3273
3 612
4 126
4 4511
5 155
5 1135
5 4654
6 1394
6 3093
6 3465
7 3793
8 2151
8 2962
9 2814
9 4275
10 1810
10 2700
10 4369
10 4398
11 2865
12 123
12 253
13 626
14 141
14 3209
14 3546
14 4930
15 4544
15 4860
16 1667
17 1546
18 2373
19 3284
21 2703
22 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 132ms = 132ms + 0ms
memory: 3500kb,1836kb

input:

1
410366615149657534

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1411 1927
4263 4798
1057 1432
1386 2461
1678 4968
664 3354
650 1085
1996 4416
2177 4890
1457 2573
2188 4544
3146 3473
518 4055
13 4232
3143 4850
482 2946
1801 2702
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1411 1927
4263 4798
1057 1432
1386 2461
1678 4968
664 3354
650 1085
1996 4416
2177 4890
1457 2573
2188 4544
3146 3473
518 4055
13 4232
3143 4850
482 2946
1801 2702
...

output:

2
5000 4708
1 2302
1 4195
2 6
2 1516
2 3361
3 1918
4 1648
4 4424
5 790
5 2136
5 2420
6 2783
6 4261
6 4907
7 3725
7 4877
8 1875
9 1652
9 3421
10 2755
10 3294
11 3995
12 103
12 3713
12 3718
13 4232
14 3819
15 3475
16 2127
17 901
17 2428
18 818
19 2522
20 4475
21 1997
21 3944
21 4757
22 325
22 3506
23 ...

input:

2
5000 4708
1 2302
1 4195
2 6
2 1516
2 3361
3 1918
4 1648
4 4424
5 790
5 2136
5 2420
6 2783
6 4261
6 4907
7 3725
7 4877
8 1875
9 1652
9 3421
10 2755
10 3294
11 3995
12 103
12 3713
12 3718
13 4232
14 3819
15 3475
16 2127
17 901
17 2428
18 818
19 2522
20 4475
21 1997
21 3944
21 4757
22 325
22 3506
23 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 105ms = 105ms + 0ms
memory: 3336kb,1840kb

input:

1
298090682780948428

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1999 2809
2702 4357
1461 1541
1960 2469
2438 3654
899 3448
879 2342
3023 3128
3413 4959
2072 3775
3439 4498
183 2519
697 3415
17 4851
4287 4814
647 4554
2652 4740
4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1999 2809
2702 4357
1461 1541
1960 2469
2438 3654
899 3448
879 2342
3023 3128
3413 4959
2072 3775
3439 4498
183 2519
697 3415
17 4851
4287 4814
647 4554
2652 4740
4...

output:

2
5000 4708
1 3039
1 3506
2 536
2 1607
2 2044
2 2506
2 3605
3 1034
4 733
5 980
5 1991
6 664
6 2470
6 3088
6 4236
6 4623
7 4016
8 3664
8 4519
9 2552
9 4567
10 1107
10 3727
11 1406
12 41
12 2381
13 3100
14 3655
15 994
15 1053
15 1135
15 1344
15 2785
15 4552
16 2572
16 2576
16 2912
17 4851
18 2980
19 9...

input:

2
5000 4708
1 3039
1 3506
2 536
2 1607
2 2044
2 2506
2 3605
3 1034
4 733
5 980
5 1991
6 664
6 2470
6 3088
6 4236
6 4623
7 4016
8 3664
8 4519
9 2552
9 4567
10 1107
10 3727
11 1406
12 41
12 2381
13 3100
14 3655
15 994
15 1053
15 1135
15 1344
15 2785
15 4552
16 2572
16 2576
16 2912
17 4851
18 2980
19 9...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

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

input:

3
969441916331132577

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1808 2056
2404 3315
1332 4593
1774 1783
2184 3955
826 2588
807 4902
2661 3288
2955 4015
1871 4230
2973 4844
169 3709
642 1559
16 3529
3476 4677
596 3754
2363 3361
4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1808 2056
2404 3315
1332 4593
1774 1783
2184 3955
826 2588
807 4902
2661 3288
2955 4015
1871 4230
2973 4844
169 3709
642 1559
16 3529
3476 4677
596 3754
2363 3361
4...

output:

4
5000 2500
1 3248
3 4574
4 4421
5 370
5 3760
7 2566
9 1250
9 2659
11 927
11 3094
12 3389
17 4138
18 1748
18 4834
21 3338
24 1529
25 3594
25 4697
28 1825
29 3350
29 3756
31 4883
33 2528
35 3744
38 3861
39 2897
40 1548
41 1948
41 4089
42 2565
42 3908
43 1292
46 1447
48 3497
51 4528
52 1489
54 1933
54...

input:

4
5000 2500
1 3248
3 4574
4 4421
5 370
5 3760
7 2566
9 1250
9 2659
11 927
11 3094
12 3389
17 4138
18 1748
18 4834
21 3338
24 1529
25 3594
25 4697
28 1825
29 3350
29 3756
31 4883
33 2528
35 3744
38 3861
39 2897
40 1548
41 1948
41 4089
42 2565
42 3908
43 1292
46 1447
48 3497
51 4528
52 1489
54 1933
54...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

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

input:

3
929489812741933634

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1521 3994
1984 3732
1135 1652
1494 3036
1817 3409
710 4836
695 2092
2173 3816
2379 4535
1572 3190
2392 3194
3569 4443
554 1715
14 3363
3566 4284
515 2256
1953 4298
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1521 3994
1984 3732
1135 1652
1494 3036
1817 3409
710 4836
695 2092
2173 3816
2379 4535
1572 3190
2392 3194
3569 4443
554 1715
14 3363
3566 4284
515 2256
1953 4298
...

output:

4
5000 2500
1 2454
4 2729
4 3714
6 3348
7 1160
7 1846
9 4334
10 1224
11 840
11 4610
14 3363
15 3247
17 3066
19 1333
20 3476
24 4091
25 3094
27 4806
28 2966
30 194
31 4219
31 4444
32 3418
33 4372
34 2880
35 4326
38 3736
39 4368
41 3334
41 3568
44 1783
45 2552
45 3169
47 139
47 367
51 1448
54 4201
55 ...

input:

4
5000 2500
1 2454
4 2729
4 3714
6 3348
7 1160
7 1846
9 4334
10 1224
11 840
11 4610
14 3363
15 3247
17 3066
19 1333
20 3476
24 4091
25 3094
27 4806
28 2966
30 194
31 4219
31 4444
32 3418
33 4372
34 2880
35 4326
38 3736
39 4368
41 3334
41 3568
44 1783
45 2552
45 3169
47 139
47 367
51 1448
54 4201
55 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

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

input:

3
144032041325838295

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1411 2131
4264 4466
1057 1608
1386 2624
1679 1790
664 3427
650 1157
1996 4648
2178 2313
1457 2751
2188 4816
3146 3810
518 4175
13 4276
3144 3330
482 2999
1801 2870
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1411 2131
4264 4466
1057 1608
1386 2624
1679 1790
664 3427
650 1157
1996 4648
2178 2313
1457 2751
2188 4816
3146 3810
518 4175
13 4276
3144 3330
482 2999
1801 2870
...

output:

4
5000 2500
1 2309
1 4195
3 1926
4 1669
4 4442
7 4920
9 1701
9 3472
11 2697
13 4276
14 3868
15 999
15 3521
16 110
16 3096
17 950
17 2474
19 2569
20 388
20 4525
21 3992
23 1626
24 2281
24 2612
27 2955
29 4895
31 4481
32 2792
33 792
33 3856
35 2833
36 2534
37 2713
38 239
39 1354
41 3739
43 1030
45 391...

input:

4
5000 2500
1 2309
1 4195
3 1926
4 1669
4 4442
7 4920
9 1701
9 3472
11 2697
13 4276
14 3868
15 999
15 3521
16 110
16 3096
17 950
17 2474
19 2569
20 388
20 4525
21 3992
23 1626
24 2281
24 2612
27 2955
29 4895
31 4481
32 2792
33 792
33 3856
35 2833
36 2534
37 2713
38 239
39 1354
41 3739
43 1030
45 391...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

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

input:

3
832110946250826180

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1584 1715
2073 4260
1178 3924
1555 2800
1896 2820
736 3561
720 2517
2275 4160
2497 4411
1637 3244
2511 3222
3868 3906
573 4495
15 640
3863 4986
533 3035
2040 4971
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1584 1715
2073 4260
1178 3924
1555 2800
1896 2820
736 3561
720 2517
2275 4160
2497 4411
1637 3244
2511 3222
3868 3906
573 4495
15 640
3863 4986
533 3035
2040 4971
3...

output:

4
5000 2500
1 4615
3 3107
8 2089
9 2769
10 2746
11 2515
17 4802
18 835
18 3957
19 2943
21 1751
22 4391
27 2310
27 2490
28 3220
29 2548
33 3678
33 4605
34 4832
35 3464
38 1662
38 3178
39 2459
41 878
41 3609
42 1136
45 4011
53 3285
53 4535
55 2261
56 4090
58 3297
59 2056
60 1851
60 2577
61 3273
62 131...

input:

4
5000 2500
1 4615
3 3107
8 2089
9 2769
10 2746
11 2515
17 4802
18 835
18 3957
19 2943
21 1751
22 4391
27 2310
27 2490
28 3220
29 2548
33 3678
33 4605
34 4832
35 3464
38 1662
38 3178
39 2459
41 878
41 3609
42 1136
45 4011
53 3285
53 4535
55 2261
56 4090
58 3297
59 2056
60 1851
60 2577
61 3273
62 131...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

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

input:

3
85728715707691821

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1898 3395
2543 3077
1393 4615
1862 2170
2303 4023
861 2666
842 1387
2827 4136
3161 4122
1966 3857
3182 4645
176 1823
668 3917
17 1535
3796 4151
621 1651
2498 3301
4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1898 3395
2543 3077
1393 4615
1862 2170
2303 4023
861 2666
842 1387
2827 4136
3161 4122
1966 3857
3182 4645
176 1823
668 3917
17 1535
3796 4151
621 1651
2498 3301
4...

output:

4
5000 2500
1 2923
1 3371
7 2656
7 3776
9 2789
9 4254
11 2834
13 604
15 1607
15 4523
18 2358
19 64
19 3273
20 2749
20 4072
21 4621
22 2296
24 2772
25 995
26 1302
26 3330
28 2758
31 2956
32 4567
33 4563
34 3730
35 1081
36 2296
38 3987
39 1261
40 2206
42 3027
42 4706
43 1975
45 2634
46 2726
49 2714
49...

input:

4
5000 2500
1 2923
1 3371
7 2656
7 3776
9 2789
9 4254
11 2834
13 604
15 1607
15 4523
18 2358
19 64
19 3273
20 2749
20 4072
21 4621
22 2296
24 2772
25 995
26 1302
26 3330
28 2758
31 2956
32 4567
33 4563
34 3730
35 1081
36 2296
38 3987
39 1261
40 2206
42 3027
42 4706
43 1975
45 2634
46 2726
49 2714
49...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

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

input:

5
777434612360931036

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1651 4728
2172 2617
1225 4493
1621 3876
1982 4392
764 2088
747 2331
2389 2926
2630 3367
1708 2867
2645 2718
4318 4686
594 4945
15 3064
4311 4751
553 774
2137 2381
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1651 4728
2172 2617
1225 4493
1621 3876
1982 4392
764 2088
747 2331
2389 2926
2630 3367
1708 2867
2645 2718
4318 4686
594 4945
15 3064
4311 4751
553 774
2137 2381
3...

output:

6
5000 2502
1 3017
2 687
2 2412
3 3550
4 3924
5 3644
6 492
7 3268
8 4669
9 3206
10 2358
12 4097
13 2662
14 1799
16 3291
17 718
18 2599
19 2036
20 1169
21 2989
22 280
23 4994
24 3267
24 4186
24 4804
25 57
25 701
26 2308
27 3370
28 2075
29 4106
30 2481
31 4651
32 207
33 4849
34 4350
36 4474
38 4904
39...

input:

6
5000 2502
1 3017
2 687
2 2412
3 3550
4 3924
5 3644
6 492
7 3268
8 4669
9 3206
10 2358
12 4097
13 2662
14 1799
16 3291
17 718
18 2599
19 2036
20 1169
21 2989
22 280
23 4994
24 3267
24 4186
24 4804
25 57
25 701
26 2308
27 3370
28 2075
29 4106
30 2481
31 4651
32 207
33 4849
34 4350
36 4474
38 4904
39...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

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

input:

5
705262511549880222

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1898 3514
2543 3141
1393 4674
1862 2168
2303 4082
861 2723
842 1387
2827 4164
3161 4258
1966 3961
3182 4661
176 1843
668 3959
17 1591
3796 4206
621 1706
2498 3430
4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1898 3514
2543 3141
1393 4674
1862 2168
2303 4082
861 2723
842 1387
2827 4164
3161 4258
1966 3961
3182 4661
176 1843
668 3959
17 1591
3796 4206
621 1706
2498 3430
4...

output:

6
5000 2513
1 2897
1 2930
2 1362
2 1777
2 2221
5 4663
6 3108
6 3475
7 4309
8 2160
9 4302
10 2733
10 4390
11 2894
12 164
13 1354
14 4970
16 1711
18 2413
19 3329
20 4123
21 2743
23 4964
24 2516
24 2835
26 3395
27 3762
28 2839
29 880
29 2134
30 3913
30 4334
31 1920
31 2833
32 4652
33 923
34 3826
35 118...

input:

6
5000 2513
1 2897
1 2930
2 1362
2 1777
2 2221
5 4663
6 3108
6 3475
7 4309
8 2160
9 4302
10 2733
10 4390
11 2894
12 164
13 1354
14 4970
16 1711
18 2413
19 3329
20 4123
21 2743
23 4964
24 2516
24 2835
26 3395
27 3762
28 2839
29 880
29 2134
30 3913
30 4334
31 1920
31 2833
32 4652
33 923
34 3826
35 118...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

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

input:

5
510318082834167951

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1521 4109
1984 3855
1135 1757
1494 3166
1817 3538
710 4926
695 2148
2173 3971
2379 4720
1572 3304
2392 3390
3569 4673
554 1762
14 3377
3566 4515
515 2301
1953 4423
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1521 4109
1984 3855
1135 1757
1494 3166
1817 3538
710 4926
695 2148
2173 3971
2379 4720
1572 3304
2392 3390
3569 4673
554 1762
14 3377
3566 4515
515 2301
1953 4423
...

output:

6
5000 2513
1 4467
2 1058
3 2694
5 683
5 2135
5 2635
5 3564
7 1157
8 2148
9 1412
10 1238
12 3655
13 2519
14 3377
15 3257
16 531
18 4964
20 3491
23 1529
23 2329
24 518
25 3098
26 157
26 2302
26 3063
27 3781
28 2970
30 191
31 4448
32 4319
35 4342
36 2644
38 1306
39 3258
41 3380
42 2595
42 3882
42 3966...

input:

6
5000 2513
1 4467
2 1058
3 2694
5 683
5 2135
5 2635
5 3564
7 1157
8 2148
9 1412
10 1238
12 3655
13 2519
14 3377
15 3257
16 531
18 4964
20 3491
23 1529
23 2329
24 518
25 3098
26 157
26 2302
26 3063
27 3781
28 2970
30 191
31 4448
32 4319
35 4342
36 2644
38 1306
39 3258
41 3380
42 2595
42 3882
42 3966...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

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

input:

5
914858813253258744

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1411 1956
4263 4932
1057 1438
1386 2524
1679 1684
664 3386
650 1050
1996 4483
2177 4961
1457 2626
2188 4603
3146 3567
518 4045
13 4240
3143 4956
482 2964
1801 2754
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1411 1956
4263 4932
1057 1438
1386 2524
1679 1684
664 3386
650 1050
1996 4483
2177 4961
1457 2626
2188 4603
3146 3567
518 4045
13 4240
3143 4956
482 2964
1801 2754
...

output:

6
5000 2503
1 4192
2 1522
3 1923
4 1660
5 811
5 1279
5 2440
6 4925
7 1368
7 4902
8 1897
9 3441
10 1441
11 292
12 113
13 4240
14 3831
15 968
16 3054
17 2428
18 821
19 2529
20 4479
21 4760
22 1094
23 1582
24 661
25 488
25 586
25 1330
26 1661
28 1386
29 4815
30 105
30 448
30 3808
31 4393
33 3754
34 112...

input:

6
5000 2503
1 4192
2 1522
3 1923
4 1660
5 811
5 1279
5 2440
6 4925
7 1368
7 4902
8 1897
9 3441
10 1441
11 292
12 113
13 4240
14 3831
15 968
16 3054
17 2428
18 821
19 2529
20 4479
21 4760
22 1094
23 1582
24 661
25 488
25 586
25 1330
26 1661
28 1386
29 4815
30 105
30 448
30 3808
31 4393
33 3754
34 112...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

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

input:

5
659635316746638238

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1195 3692
3061 4223
902 3280
1175 2266
1413 1830
571 3357
559 1763
1665 2688
1805 4011
1233 2835
1814 1889
2495 4117
447 1809
12 761
2494 2990
416 1803
1510 4936
29...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1195 3692
3061 4223
902 3280
1175 2266
1413 1830
571 3357
559 1763
1665 2688
1805 4011
1233 2835
1814 1889
2495 4117
447 1809
12 761
2494 2990
416 1803
1510 4936
29...

output:

6
5000 2520
1 2003
1 3642
4 1880
5 3134
6 428
7 3782
9 1469
10 1880
11 1201
12 761
13 3785
15 229
16 4913
17 324
18 3534
19 245
19 949
19 2088
19 4188
20 1854
21 392
21 2052
21 4423
22 4090
25 1201
26 775
27 4026
28 4461
30 3238
31 3878
34 785
34 974
35 273
35 412
35 1719
35 2466
36 1726
37 1426
38 ...

input:

6
5000 2520
1 2003
1 3642
4 1880
5 3134
6 428
7 3782
9 1469
10 1880
11 1201
12 761
13 3785
15 229
16 4913
17 324
18 3534
19 245
19 949
19 2088
19 4188
20 1854
21 392
21 2052
21 4423
22 4090
25 1201
26 775
27 4026
28 4461
30 3238
31 3878
34 785
34 974
35 273
35 412
35 1719
35 2466
36 1726
37 1426
38 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

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

input:

7
858490260563149759

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1011 3436
2420 4140
768 2025
994 4262
3244 4222
489 3005
479 829
1392 4397
1504 2453
1042 3755
1510 4460
2029 3247
383 4493
10 3143
2028 3077
357 2584
1268 4609
254...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1011 3436
2420 4140
768 2025
994 4262
3244 4222
489 3005
479 829
1392 4397
1504 2453
1042 3755
1510 4460
2029 3247
383 4493
10 3143
2028 3077
357 2584
1268 4609
254...

output:

8
5000 2500
2 1276
3 2489
4 1823
5 1951
6 4166
7 1229
8 3956
9 2292
9 4208
10 3143
12 78
13 635
14 4333
14 4517
15 4546
17 3607
18 3101
19 4177
20 1245
21 1853
22 3716
23 2145
24 713
24 3164
26 2148
27 2840
28 997
29 3265
31 158
32 1612
33 1410
33 2085
34 3227
35 2069
35 3288
36 660
36 1893
38 316
3...

input:

8
5000 2500
2 1276
3 2489
4 1823
5 1951
6 4166
7 1229
8 3956
9 2292
9 4208
10 3143
12 78
13 635
14 4333
14 4517
15 4546
17 3607
18 3101
19 4177
20 1245
21 1853
22 3716
23 2145
24 713
24 3164
26 2148
27 2840
28 997
29 3265
31 158
32 1612
33 1410
33 2085
34 3227
35 2069
35 3288
36 660
36 1893
38 316
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

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

input:

7
860058643727731209

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1521 3990
1984 3680
1135 1606
1494 2984
1817 3394
710 4831
695 2156
2173 3791
2379 4535
1572 3182
2392 3119
3569 4394
554 1742
14 3402
3566 4221
515 2321
1953 4314
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1521 3990
1984 3680
1135 1606
1494 2984
1817 3394
710 4831
695 2156
2173 3791
2379 4535
1572 3182
2392 3119
3569 4394
554 1742
14 3402
3566 4221
515 2321
1953 4314
...

output:

8
5000 2500
1 567
1 2455
2 346
4 2745
4 4229
6 3368
7 1184
7 1871
8 942
8 4286
9 725
9 1440
9 4364
10 1261
11 878
12 359
12 2517
14 3402
15 3282
16 3246
17 2131
18 1153
18 4995
19 1382
20 3516
20 3782
21 572
21 1479
22 2640
25 4818
27 3831
27 4864
28 3025
29 1526
30 263
31 4288
31 4520
31 4883
32 34...

input:

8
5000 2500
1 567
1 2455
2 346
4 2745
4 4229
6 3368
7 1184
7 1871
8 942
8 4286
9 725
9 1440
9 4364
10 1261
11 878
12 359
12 2517
14 3402
15 3282
16 3246
17 2131
18 1153
18 4995
19 1382
20 3516
20 3782
21 572
21 1479
22 2640
25 4818
27 3831
27 4864
28 3025
29 1526
30 263
31 4288
31 4520
31 4883
32 34...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

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

input:

7
718861404514377808

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1898 3407
2543 3032
1393 4629
1862 2112
2303 3991
861 2678
842 1369
2827 4067
3161 4053
1966 3777
3182 4545
176 1777
668 3946
17 1589
3796 4059
621 1675
2498 3294
4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1898 3407
2543 3032
1393 4629
1862 2112
2303 3991
861 2678
842 1369
2827 4067
3161 4053
1966 3777
3182 4545
176 1777
668 3946
17 1589
3796 4059
621 1675
2498 3294
4...

output:

8
5000 2500
1 2930
1 3375
3 634
4 149
5 1158
5 4674
6 3113
7 3820
8 2177
8 2988
9 2850
9 4306
10 2738
11 2908
12 164
13 672
14 3581
14 4970
15 1657
15 4897
16 1709
18 2413
19 121
19 3326
20 2952
20 4115
21 2735
22 2349
23 4956
24 2519
24 2833
25 1094
26 1374
27 3084
27 3778
28 2847
29 374
31 1161
32...

input:

8
5000 2500
1 2930
1 3375
3 634
4 149
5 1158
5 4674
6 3113
7 3820
8 2177
8 2988
9 2850
9 4306
10 2738
11 2908
12 164
13 672
14 3581
14 4970
15 1657
15 4897
16 1709
18 2413
19 121
19 3326
20 2952
20 4115
21 2735
22 2349
23 4956
24 2519
24 2833
25 1094
26 1374
27 3084
27 3778
28 2847
29 374
31 1161
32...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

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

input:

7
659192688464047828

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1521 4045
1984 3780
1135 1707
1494 3109
1817 3470
710 4898
695 2112
2173 3880
2379 4624
1572 3237
2392 3296
3569 4562
554 1728
14 3356
3566 4416
515 2266
1953 4354
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1521 4045
1984 3780
1135 1707
1494 3109
1817 3470
710 4898
695 2112
2173 3880
2379 4624
1572 3237
2392 3296
3569 4562
554 1728
14 3356
3566 4416
515 2266
1953 4354
...

output:

8
5000 2500
2 327
2 1049
3 2680
4 2714
6 3332
6 4570
7 3360
9 1399
9 4324
10 1219
11 4611
12 2469
12 3634
14 3356
15 3241
17 3065
18 1108
18 4950
19 1333
20 3477
20 3738
21 1440
22 2600
24 522
25 3106
27 4821
28 1729
32 3416
33 320
33 4365
35 4327
36 766
36 2629
38 3749
39 3231
39 4386
40 2071
41 33...

input:

8
5000 2500
2 327
2 1049
3 2680
4 2714
6 3332
6 4570
7 3360
9 1399
9 4324
10 1219
11 4611
12 2469
12 3634
14 3356
15 3241
17 3065
18 1108
18 4950
19 1333
20 3477
20 3738
21 1440
22 2600
24 522
25 3106
27 4821
28 1729
32 3416
33 320
33 4365
35 4327
36 766
36 2629
38 3749
39 3231
39 4386
40 2071
41 33...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

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

input:

7
685730986714800201

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
2387 3838
3390 4503
1709 4688
2336 4188
2987 4646
1037 4645
1014 1349
3982 4994
618 4938
2483 4682
1914 2925
208 4548
801 3172
20 1419
687 4176
743 3775
3310 4900
5...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
2387 3838
3390 4503
1709 4688
2336 4188
2987 4646
1037 4645
1014 1349
3982 4994
618 4938
2483 4682
1914 2925
208 4548
801 3172
20 1419
687 4176
743 3775
3310 4900
5...

output:

8
5000 2500
1 3458
3 1023
4 2889
7 3648
8 4945
9 3910
10 2043
12 354
13 2513
14 186
15 1685
16 2837
16 3002
18 3518
19 3701
20 1419
21 3302
22 1935
23 316
24 789
25 1452
30 1802
33 2939
34 908
34 1544
34 3021
35 361
39 233
40 2890
41 584
41 2341
42 3511
43 3372
44 2616
44 2938
45 515
46 1214
47 1958...

input:

8
5000 2500
1 3458
3 1023
4 2889
7 3648
8 4945
9 3910
10 2043
12 354
13 2513
14 186
15 1685
16 2837
16 3002
18 3518
19 3701
20 1419
21 3302
22 1935
23 316
24 789
25 1452
30 1802
33 2939
34 908
34 1544
34 3021
35 361
39 233
40 2890
41 584
41 2341
42 3511
43 3372
44 2616
44 2938
45 515
46 1214
47 1958...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201