QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#421447#8726. Magic Showdengziyue100 ✓2ms2028kbC++141.1kb2024-05-25 18:50:132024-05-25 18:50:14

Judging History

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

  • [2024-05-25 18:50:14]
  • 评测
  • 测评结果:100
  • 用时:2ms
  • 内存:2028kb
  • [2024-05-25 18:50:13]
  • 提交

Alice

#include<bits/stdc++.h>
#include"Alice.h"
using namespace std;
long long setN(int n);
vector<pair<int,int>>Alice(){
	srand(20080715);
	int p[5002];
	for(int i=1;i<=5000;++i)p[i]=i;
	for(int ca=1;ca<=10;++ca)random_shuffle(p+1,p+5001);
	long long w=setN(5000);
	vector<pair<int,int>>res;
	for(int i=2;i<=5000;++i)res.push_back({p[w%(i-1)+1],p[i]});
	return res;
}

Bob

#include<bits/stdc++.h>
#include"Bob.h"
using namespace std;
struct S{__int128 y,w;};
__int128 gcd(__int128 a,__int128 b){return b?gcd(b,a%b):a;}
long long Bob(vector<pair<int,int>>e){
	srand(20080715);
	int p[5002],a[5002];
	for(int i=1;i<=5000;++i)p[i]=i;
	for(int ca=1;ca<=10;++ca)random_shuffle(p+1,p+5001);
	for(int i=1;i<=5000;++i)a[p[i]]=i;
	vector<S>s;
	for(auto p:e){
		int u=a[p.first],v=a[p.second];
		if(u>v)swap(u,v);
		s.push_back((S){v-1,u-1});
	}
	sort(s.begin(),s.end(),[](S a,S b){return a.y<b.y;});
	__int128 lcm=s[0].y,ans=s[0].w;
	for(int i=1,len=s.size();i<len&&lcm<=((__int128)3e18);++i){
		while(ans%s[i].y!=s[i].w)ans+=lcm;
		lcm=lcm/gcd(lcm,s[i].y)*s[i].y;
	}
	return ((long long)ans);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1888kb,2024kb

input:

1
4005

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
3379 2346
1567 1833
2892 93
3379 4233
1833 3203
1567 3657
1833 2862
3379 549
3657 470
3379 653
3379 1534
1567 4802
1833 1417
2862 1370...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
3379 2346
1567 1833
2892 93
3379 4233
1833 3203
1567 3657
1833 2862
3379 549
3657 470
3379 653
3379 1534
1567 4802
1833 1417
2862 1370...

output:

2
5000 4308
1 1270
1 2198
2 2554
3 955
4 93
4 159
4 520
4 849
4 1306
4 1625
4 3034
4 3164
5 4926
6 1723
7 373
7 3521
8 721
9 2554
10 3292
11 2554
12 1679
13 1981
14 1667
15 1037
15 1974
15 1986
17 745
17 1876
17 2912
17 2959
17 3322
17 3740
17 4626
18 2948
18 3196
19 235
20 2554
21 2554
22 1561
23 2...

input:

2
5000 4308
1 1270
1 2198
2 2554
3 955
4 93
4 159
4 520
4 849
4 1306
4 1625
4 3034
4 3164
5 4926
6 1723
7 373
7 3521
8 721
9 2554
10 3292
11 2554
12 1679
13 1981
14 1667
15 1037
15 1974
15 1986
17 745
17 1876
17 2912
17 2959
17 3322
17 3740
17 4626
18 2948
18 3196
19 235
20 2554
21 2554
22 1561
23 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,2024kb

input:

1
459

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
2892 2346
2346 1833
2892 93
2346 4233
2892 3203
1567 3657
3657 2862
3203 549
2892 470
2346 653
549 1534
3657 4802
549 1417
1567 1370
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
2892 2346
2346 1833
2892 93
2346 4233
2892 3203
1567 3657
3657 2862
3203 549
2892 470
2346 653
549 1534
3657 4802
549 1417
1567 1370
3...

output:

2
5000 4308
1 2947
2 2947
3 2947
4 745
4 1115
4 4734
5 2947
6 2947
7 2947
8 2947
9 2947
10 2947
11 2947
12 2947
13 2947
14 3795
14 4332
15 2947
17 2350
17 4856
17 4901
18 2947
19 2947
20 2947
21 2947
22 2947
23 2947
24 2947
25 2947
26 2947
27 2947
28 2947
29 2947
30 2947
32 2947
33 2947
34 2947
35 2...

input:

2
5000 4308
1 2947
2 2947
3 2947
4 745
4 1115
4 4734
5 2947
6 2947
7 2947
8 2947
9 2947
10 2947
11 2947
12 2947
13 2947
14 3795
14 4332
15 2947
17 2350
17 4856
17 4901
18 2947
19 2947
20 2947
21 2947
22 2947
23 2947
24 2947
25 2947
26 2947
27 2947
28 2947
29 2947
30 2947
32 2947
33 2947
34 2947
35 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,2028kb

input:

1
2495

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
4462 2892
2892 2346
1567 1833
1833 93
2892 4233
4233 3203
4462 3657
1833 2862
3657 549
549 470
470 653
2892 1534
1833 4802
4802 1417
653 1370
54...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
4462 2892
2892 2346
1567 1833
1833 93
2892 4233
4233 3203
4462 3657
1833 2862
3657 549
549 470
470 653
2892 1534
1833 4802
4802 1417
653 1370
54...

output:

2
5000 4308
1 617
1 2931
2 4701
3 4701
4 61
4 2561
4 3078
5 2632
6 4701
7 3765
8 4701
9 4701
10 4701
11 4701
12 3390
13 4701
14 550
14 4107
15 27
15 1937
15 2411
17 59
17 607
17 1314
17 2436
17 2829
17 3702
17 3765
17 4019
17 4545
18 2233
19 4701
20 4701
21 4701
22 2213
23 4701
24 4701
25 4701
26 47...

input:

2
5000 4308
1 617
1 2931
2 4701
3 4701
4 61
4 2561
4 3078
5 2632
6 4701
7 3765
8 4701
9 4701
10 4701
11 4701
12 3390
13 4701
14 550
14 4107
15 27
15 1937
15 2411
17 59
17 607
17 1314
17 2436
17 2829
17 3702
17 3765
17 4019
17 4545
18 2233
19 4701
20 4701
21 4701
22 2213
23 4701
24 4701
25 4701
26 47...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1944kb

input:

3
1560

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
1567 2892
1567 2346
1567 1833
1567 93
93 4233
1567 3203
2892 3657
1567 2862
3657 549
1567 470
1567 653
93 1534
1567 4802
3203 1417
653 1370
470 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
1567 2892
1567 2346
1567 1833
1567 93
93 4233
1567 3203
2892 3657
1567 2862
3657 549
1567 470
1567 653
93 1534
1567 4802
3203 1417
653 1370
470 ...

output:

4
5000 3438
2 2924
3 2924
5 2924
6 2924
8 2924
9 2924
10 2924
11 2924
12 2924
13 2924
16 2924
19 2924
20 2924
21 2924
22 2924
23 2924
24 2924
25 2924
26 2924
28 2924
31 2924
33 2924
34 2924
35 2924
37 2924
38 2924
39 2924
40 2924
42 2924
44 2924
46 2924
47 2924
50 2924
51 2924
52 2924
54 2924
56 292...

input:

4
5000 3438
2 2924
3 2924
5 2924
6 2924
8 2924
9 2924
10 2924
11 2924
12 2924
13 2924
16 2924
19 2924
20 2924
21 2924
22 2924
23 2924
24 2924
25 2924
26 2924
28 2924
31 2924
33 2924
34 2924
35 2924
37 2924
38 2924
39 2924
40 2924
42 2924
44 2924
46 2924
47 2924
50 2924
51 2924
52 2924
54 2924
56 292...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1936kb

input:

3
3594

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
1567 2892
4462 2346
2346 1833
1567 93
2892 4233
4462 3203
2892 3657
2346 2862
3203 549
93 470
93 653
2862 1534
3657 4802
2862 1417
4233 1370
470...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
1567 2892
4462 2346
2346 1833
1567 93
2892 4233
4462 3203
2892 3657
2346 2862
3203 549
93 470
93 653
2862 1534
3657 4802
2862 1417
4233 1370
470...

output:

4
5000 2500
1 811
2 4404
5 1718
6 4404
7 2065
9 4404
11 4404
12 4581
13 1225
15 130
16 4404
18 2339
18 4762
20 4404
21 4404
23 4404
24 4404
25 3193
29 4189
30 185
30 4856
31 4404
32 2850
33 4938
34 770
38 3796
39 3908
40 3237
41 1664
42 4404
43 1165
44 4404
45 4759
46 4404
47 4404
48 652
50 4404
51 ...

input:

4
5000 2500
1 811
2 4404
5 1718
6 4404
7 2065
9 4404
11 4404
12 4581
13 1225
15 130
16 4404
18 2339
18 4762
20 4404
21 4404
23 4404
24 4404
25 3193
29 4189
30 185
30 4856
31 4404
32 2850
33 4938
34 770
38 3796
39 3908
40 3237
41 1664
42 4404
43 1165
44 4404
45 4759
46 4404
47 4404
48 652
50 4404
51 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1884kb,1948kb

input:

3
1750

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
3379 2892
4462 2346
1567 1833
2346 93
1567 4233
93 3203
2346 3657
1567 2862
3379 549
2862 470
3203 653
1567 1534
2862 4802
93 1417
1417 1370
234...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
3379 2892
4462 2346
1567 1833
2346 93
1567 4233
93 3203
2346 3657
1567 2862
3379 549
2862 470
3203 653
1567 1534
2862 4802
93 1417
1417 1370
234...

output:

4
5000 3248
2 671
3 671
5 671
6 671
8 671
9 671
10 671
11 671
12 671
13 671
16 671
19 671
20 671
21 671
22 671
23 671
24 671
25 671
26 671
28 671
31 671
33 671
34 671
35 671
37 671
38 671
39 671
40 671
42 671
44 671
46 671
47 671
50 671
51 671
52 671
56 671
57 671
58 671
61 671
62 671
63 671
64 671
...

input:

4
5000 3248
2 671
3 671
5 671
6 671
8 671
9 671
10 671
11 671
12 671
13 671
16 671
19 671
20 671
21 671
22 671
23 671
24 671
25 671
26 671
28 671
31 671
33 671
34 671
35 671
37 671
38 671
39 671
40 671
42 671
44 671
46 671
47 671
50 671
51 671
52 671
56 671
57 671
58 671
61 671
62 671
63 671
64 671
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

5
4878

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
4462 2346
2892 1833
1567 93
93 4233
93 3203
1567 3657
3203 2862
1833 549
93 470
2892 653
93 1534
2892 4802
1534 1417
1417 1370
1567 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
4462 2346
2892 1833
1567 93
93 4233
93 3203
1567 3657
3203 2862
1833 549
93 470
2892 653
93 1534
2892 4802
1534 1417
1417 1370
1567 33...

output:

6
5000 2559
1 578
1 2754
3 79
4 491
4 993
4 1452
4 2600
4 2696
4 3998
4 4808
5 4363
7 2134
7 3841
8 3114
10 382
12 1019
13 4221
14 944
14 4489
15 500
16 3100
17 1591
17 2018
18 3697
19 1512
22 4558
23 4746
25 1140
27 2449
27 2511
27 3780
28 1009
29 3857
30 3095
31 2317
32 3053
33 804
34 3524
36 226
...

input:

6
5000 2559
1 578
1 2754
3 79
4 491
4 993
4 1452
4 2600
4 2696
4 3998
4 4808
5 4363
7 2134
7 3841
8 3114
10 382
12 1019
13 4221
14 944
14 4489
15 500
16 3100
17 1591
17 2018
18 3697
19 1512
22 4558
23 4746
25 1140
27 2449
27 2511
27 3780
28 1009
29 3857
30 3095
31 2317
32 3053
33 804
34 3524
36 226
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,2020kb

input:

5
1223

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
3379 4462
4462 2892
2892 2346
2892 1833
1833 93
1833 4233
4233 3203
3203 3657
2892 2862
4462 549
549 470
3379 653
1833 1534
3203 4802
4233 1417
1417 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
3379 4462
4462 2892
2892 2346
2892 1833
1833 93
1833 4233
4233 3203
3203 3657
2892 2862
4462 549
549 470
3379 653
1833 1534
3203 4802
4233 1417
1417 1370
...

output:

6
5000 4387
2 3791
3 3791
4 1534
5 3791
6 3791
7 3791
8 3791
9 3791
10 3791
11 3791
12 3791
13 3791
14 4233
16 3791
17 549
18 3791
19 3791
20 3791
21 3791
22 3791
23 3791
24 3791
25 3791
26 3791
27 2602
28 3791
29 3791
30 4583
31 3791
32 3791
33 3791
34 3791
35 3791
36 1078
37 3791
38 3791
39 3791
4...

input:

6
5000 4387
2 3791
3 3791
4 1534
5 3791
6 3791
7 3791
8 3791
9 3791
10 3791
11 3791
12 3791
13 3791
14 4233
16 3791
17 549
18 3791
19 3791
20 3791
21 3791
22 3791
23 3791
24 3791
25 3791
26 3791
27 2602
28 3791
29 3791
30 4583
31 3791
32 3791
33 3791
34 3791
35 3791
36 1078
37 3791
38 3791
39 3791
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,2024kb

input:

5
648

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
2892 1833
1567 93
2346 4233
1567 3203
1567 3657
3203 2862
2862 549
1567 470
549 653
2346 1534
2892 4802
3203 1417
4462 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
2892 1833
1567 93
2346 4233
1567 3203
1567 3657
3203 2862
2862 549
1567 470
549 653
2346 1534
2892 4802
3203 1417
4462 1370
...

output:

6
5000 4674
2 1380
3 1380
4 785
4 2592
4 3521
5 1380
6 1380
7 1380
8 1380
9 1380
10 1380
11 1380
12 1380
13 1380
14 3203
15 1380
16 1380
17 1509
18 1380
19 1380
20 1380
21 1380
22 1380
23 1380
24 1380
25 1380
26 1380
28 1380
29 1380
30 1380
31 1380
32 1380
33 1380
34 1380
35 1380
36 470
37 1380
38 1...

input:

6
5000 4674
2 1380
3 1380
4 785
4 2592
4 3521
5 1380
6 1380
7 1380
8 1380
9 1380
10 1380
11 1380
12 1380
13 1380
14 3203
15 1380
16 1380
17 1509
18 1380
19 1380
20 1380
21 1380
22 1380
23 1380
24 1380
25 1380
26 1380
28 1380
29 1380
30 1380
31 1380
32 1380
33 1380
34 1380
35 1380
36 470
37 1380
38 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

7
4475

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
4462 2892
2892 2346
1567 1833
1833 93
4462 4233
2892 3203
4462 3657
1833 2862
3657 549
549 470
2892 653
3657 1534
1833 4802
549 1417
2346 1370
5...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
4462 2892
2892 2346
1567 1833
1833 93
4462 4233
2892 3203
4462 3657
1833 2862
3657 549
549 470
2892 653
3657 1534
1833 4802
549 1417
2346 1370
5...

output:

8
5000 2500
1 4774
2 3322
3 4074
5 3843
7 1327
8 2453
9 1948
10 4494
11 1948
12 709
13 422
14 2161
16 502
18 1424
19 2306
21 1948
22 505
24 4908
25 1706
26 3832
28 4971
29 1020
29 4092
31 1948
32 1095
32 2875
33 958
34 4443
35 2661
37 731
38 2050
39 3548
40 4229
41 3293
41 3630
45 3147
45 4963
46 44...

input:

8
5000 2500
1 4774
2 3322
3 4074
5 3843
7 1327
8 2453
9 1948
10 4494
11 1948
12 709
13 422
14 2161
16 502
18 1424
19 2306
21 1948
22 505
24 4908
25 1706
26 3832
28 4971
29 1020
29 4092
31 1948
32 1095
32 2875
33 958
34 4443
35 2661
37 731
38 2050
39 3548
40 4229
41 3293
41 3630
45 3147
45 4963
46 44...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1932kb

input:

7
4240

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
3379 2892
1567 2346
1567 1833
2346 93
1833 4233
1567 3203
3379 3657
1567 2862
1833 549
2346 470
4462 653
470 1534
2862 4802
1567 1417
4233 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
3379 2892
1567 2346
1567 1833
2346 93
1833 4233
1567 3203
3379 3657
1567 2862
1833 549
2346 470
4462 653
470 1534
2862 4802
1567 1417
4233 1370
...

output:

8
5000 2500
1 66
2 3657
3 1706
5 4810
7 1845
7 2759
8 4635
9 4787
10 3240
11 4787
12 4857
13 2602
16 2435
17 283
18 1486
19 2795
20 4787
21 4787
22 2411
24 1989
25 955
26 3694
28 2657
29 111
30 2363
31 4787
32 588
33 2720
34 151
35 2406
37 1085
38 2574
39 1336
40 2497
41 681
41 2371
43 4039
44 4787
...

input:

8
5000 2500
1 66
2 3657
3 1706
5 4810
7 1845
7 2759
8 4635
9 4787
10 3240
11 4787
12 4857
13 2602
16 2435
17 283
18 1486
19 2795
20 4787
21 4787
22 2411
24 1989
25 955
26 3694
28 2657
29 111
30 2363
31 4787
32 588
33 2720
34 151
35 2406
37 1085
38 2574
39 1336
40 2497
41 681
41 2371
43 4039
44 4787
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

7
1291

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
2892 2346
3379 1833
3379 93
2892 4233
2892 3203
2346 3657
3379 2862
2346 549
4233 470
2346 653
2892 1534
3379 4802
549 1417
1417 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
2892 2346
3379 1833
3379 93
2892 4233
2892 3203
2346 3657
3379 2862
2346 549
4233 470
2346 653
2892 1534
3379 4802
549 1417
1417 1370
...

output:

8
5000 2500
5 1888
7 1888
8 1888
9 1888
11 1888
16 1888
19 1888
22 1888
23 1888
28 1888
29 1888
31 1888
34 1888
37 1888
38 1888
39 1888
40 1888
42 1888
46 1888
47 1888
50 1888
52 1888
54 1888
61 1888
62 1888
63 1888
64 1888
65 1888
69 1888
70 1888
71 1888
73 1888
74 1888
77 1888
78 1888
79 1888
80 1...

input:

8
5000 2500
5 1888
7 1888
8 1888
9 1888
11 1888
16 1888
19 1888
22 1888
23 1888
28 1888
29 1888
31 1888
34 1888
37 1888
38 1888
39 1888
40 1888
42 1888
46 1888
47 1888
50 1888
52 1888
54 1888
61 1888
62 1888
63 1888
64 1888
65 1888
69 1888
70 1888
71 1888
73 1888
74 1888
77 1888
78 1888
79 1888
80 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,2028kb

input:

1
17476204

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
1567 2346
2346 1833
2346 93
2346 4233
2346 3203
2346 3657
2346 2862
3657 549
2346 470
1833 653
2346 1534
2346 4802
470 1417
1567 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
1567 2346
2346 1833
2346 93
2346 4233
2346 3203
2346 3657
2346 2862
3657 549
2346 470
1833 653
2346 1534
2346 4802
470 1417
1567 1370
...

output:

2
5000 4308
1 1716
2 2449
3 153
3 1373
4 1417
5 2006
5 3516
6 3608
7 4283
8 4827
9 1349
10 4650
11 4739
12 888
13 3870
15 1013
17 1509
17 4831
18 625
18 641
18 2346
18 2866
19 4913
20 3303
21 1373
22 2939
23 3804
24 1076
25 3076
26 86
27 603
27 1506
27 3785
28 1762
29 477
30 4727
32 1102
32 4336
33 ...

input:

2
5000 4308
1 1716
2 2449
3 153
3 1373
4 1417
5 2006
5 3516
6 3608
7 4283
8 4827
9 1349
10 4650
11 4739
12 888
13 3870
15 1013
17 1509
17 4831
18 625
18 641
18 2346
18 2866
19 4913
20 3303
21 1373
22 2939
23 3804
24 1076
25 3076
26 86
27 603
27 1506
27 3785
28 1762
29 477
30 4727
32 1102
32 4336
33 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,2024kb

input:

1
11926600

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
1567 2346
1567 1833
2346 93
1567 4233
1567 3203
4233 3657
1567 2862
2346 549
2346 470
2862 653
1567 1534
2862 4802
3203 1417
470 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
1567 2346
1567 1833
2346 93
1567 4233
1567 3203
4233 3657
1567 2862
2346 549
2346 470
2862 653
1567 1534
2862 4802
3203 1417
470 1370
...

output:

2
5000 4308
1 2277
1 4360
2 2046
3 3151
4 3379
4 3880
5 1134
6 2358
7 4596
8 429
8 1069
8 2264
8 3107
8 3117
8 3141
9 2483
10 4953
11 1447
12 1936
13 4092
14 161
14 3664
15 3761
17 3448
17 4802
18 1567
18 2493
18 3275
19 2623
19 2934
19 3258
20 4461
21 4030
22 3344
23 866
24 3117
25 1899
26 1129
26 ...

input:

2
5000 4308
1 2277
1 4360
2 2046
3 3151
4 3379
4 3880
5 1134
6 2358
7 4596
8 429
8 1069
8 2264
8 3107
8 3117
8 3141
9 2483
10 4953
11 1447
12 1936
13 4092
14 161
14 3664
15 3761
17 3448
17 4802
18 1567
18 2493
18 3275
19 2623
19 2934
19 3258
20 4461
21 4030
22 3344
23 866
24 3117
25 1899
26 1129
26 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,2020kb

input:

1
16602378

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
1567 2892
4462 2346
2892 1833
1567 93
4462 4233
4462 3203
93 3657
3203 2862
3379 549
93 470
1567 653
4462 1534
2892 4802
2862 1417
3203 1370
93 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
1567 2892
4462 2346
2892 1833
1567 93
4462 4233
4462 3203
93 3657
3203 2862
3379 549
93 470
1567 653
4462 1534
2892 4802
2862 1417
3203 1370
93 ...

output:

2
5000 4308
1 32
1 607
1 1011
2 1295
3 787
4 15
4 89
4 818
4 1156
4 1338
4 1342
4 1345
4 1724
4 1822
4 2553
4 2646
4 2843
4 2981
4 2989
4 3093
4 3094
4 3374
4 3522
4 3887
4 3922
4 4530
4 4979
5 1144
6 59
7 883
7 885
7 1170
7 1900
7 4376
8 4505
9 4125
10 781
11 4958
12 2924
13 2119
14 1704
14 4692
15...

input:

2
5000 4308
1 32
1 607
1 1011
2 1295
3 787
4 15
4 89
4 818
4 1156
4 1338
4 1342
4 1345
4 1724
4 1822
4 2553
4 2646
4 2843
4 2981
4 2989
4 3093
4 3094
4 3374
4 3522
4 3887
4 3922
4 4530
4 4979
5 1144
6 59
7 883
7 885
7 1170
7 1900
7 4376
8 4505
9 4125
10 781
11 4958
12 2924
13 2119
14 1704
14 4692
15...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1928kb

input:

3
13129243

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
3379 2892
2892 2346
2892 1833
3379 93
3379 4233
2892 3203
4233 3657
2892 2862
93 549
4233 470
2862 653
3379 1534
653 4802
549 1417
4233 1370
423...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
3379 2892
2892 2346
2892 1833
3379 93
3379 4233
2892 3203
4233 3657
2892 2862
93 549
4233 470
2862 653
3379 1534
653 4802
549 1417
4233 1370
423...

output:

4
5000 2500
2 3695
3 598
6 4687
11 839
11 1760
11 2390
13 1124
13 1219
13 4799
14 1668
14 1988
14 2244
16 110
17 4564
18 2271
19 2068
20 3332
23 2181
24 1887
25 2527
26 2327
31 91
33 2537
33 4341
35 1884
35 4226
36 672
36 3926
36 4142
36 4700
38 402
39 348
39 1485
39 3148
40 1743
40 3279
40 4407
41 ...

input:

4
5000 2500
2 3695
3 598
6 4687
11 839
11 1760
11 2390
13 1124
13 1219
13 4799
14 1668
14 1988
14 2244
16 110
17 4564
18 2271
19 2068
20 3332
23 2181
24 1887
25 2527
26 2327
31 91
33 2537
33 4341
35 1884
35 4226
36 672
36 3926
36 4142
36 4700
38 402
39 348
39 1485
39 3148
40 1743
40 3279
40 4407
41 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

3
7892141

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
4462 2892
3379 2346
3379 1833
1833 93
1833 4233
1833 3203
1833 3657
3379 2862
2346 549
1833 470
2862 653
1833 1534
549 4802
653 1417
2862 1370
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
4462 2892
3379 2346
3379 1833
1833 93
1833 4233
1833 3203
1833 3657
3379 2862
2346 549
1833 470
2862 653
1833 1534
549 4802
653 1417
2862 1370
1...

output:

4
5000 2500
1 1607
2 2909
4 2440
4 2705
4 4282
5 717
5 3578
5 4858
6 1208
9 3045
10 401
10 1088
11 1866
12 3300
13 3740
14 1636
14 2392
14 3627
15 2190
16 715
19 4424
20 466
24 1798
25 2084
26 488
29 4263
30 4761
31 3823
33 4520
34 637
34 700
34 2210
34 3617
37 3094
38 966
38 1523
38 1910
39 4620
40...

input:

4
5000 2500
1 1607
2 2909
4 2440
4 2705
4 4282
5 717
5 3578
5 4858
6 1208
9 3045
10 401
10 1088
11 1866
12 3300
13 3740
14 1636
14 2392
14 3627
15 2190
16 715
19 4424
20 466
24 1798
25 2084
26 488
29 4263
30 4761
31 3823
33 4520
34 637
34 700
34 2210
34 3617
37 3094
38 966
38 1523
38 1910
39 4620
40...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1936kb

input:

3
21314775

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
1567 2892
2892 2346
1567 1833
2892 93
93 4233
4233 3203
2892 3657
1833 2862
3657 549
2892 470
3379 653
653 1534
1567 4802
4233 1417
1833 1370
28...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
1567 2892
2892 2346
1567 1833
2892 93
93 4233
4233 3203
2892 3657
1833 2862
3657 549
2892 470
3379 653
653 1534
1567 4802
4233 1417
1833 1370
28...

output:

4
5000 2500
2 3173
2 3403
2 4465
5 264
5 1927
6 2712
7 462
8 2223
8 4714
9 311
11 224
11 3423
12 4215
13 3539
15 2509
16 4279
17 1568
17 1989
17 2727
17 3038
17 4073
17 4287
18 2551
20 900
21 1783
22 134
22 1859
22 2109
22 3211
22 4140
23 338
24 2741
25 261
26 2920
28 1987
29 3718
30 275
30 3644
30 ...

input:

4
5000 2500
2 3173
2 3403
2 4465
5 264
5 1927
6 2712
7 462
8 2223
8 4714
9 311
11 224
11 3423
12 4215
13 3539
15 2509
16 4279
17 1568
17 1989
17 2727
17 3038
17 4073
17 4287
18 2551
20 900
21 1783
22 134
22 1859
22 2109
22 3211
22 4140
23 338
24 2741
25 261
26 2920
28 1987
29 3718
30 275
30 3644
30 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

5
5559540

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
1567 1833
1567 93
1567 4233
2346 3203
93 3657
1567 2862
3203 549
1567 470
470 653
1567 1534
1567 4802
2346 1417
653 1370
93 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
1567 1833
1567 93
1567 4233
2346 3203
93 3657
1567 2862
3203 549
1567 470
470 653
1567 1534
1567 4802
2346 1417
653 1370
93 ...

output:

6
5000 2531
2 93
3 2129
5 2547
6 4472
9 887
10 359
12 3556
14 1992
15 2950
15 3819
16 4083
17 3079
17 4074
18 1603
22 3003
23 3370
25 1202
26 235
27 2216
28 3288
30 4225
31 3351
34 2322
35 819
36 2989
37 4320
38 2891
41 278
42 73
43 3030
44 4478
45 546
45 1354
46 2521
48 1293
48 3528
52 3356
54 1714...

input:

6
5000 2531
2 93
3 2129
5 2547
6 4472
9 887
10 359
12 3556
14 1992
15 2950
15 3819
16 4083
17 3079
17 4074
18 1603
22 3003
23 3370
25 1202
26 235
27 2216
28 3288
30 4225
31 3351
34 2322
35 819
36 2989
37 4320
38 2891
41 278
42 73
43 3030
44 4478
45 546
45 1354
46 2521
48 1293
48 3528
52 3356
54 1714...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

5
9424319

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
3379 4462
4462 2892
2892 2346
2346 1833
1833 93
4462 4233
4233 3203
1833 3657
3657 2862
2892 549
549 470
3203 653
3657 1534
1534 4802
4802 1417
470 1370
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
3379 4462
4462 2892
2892 2346
2346 1833
1833 93
4462 4233
4233 3203
1833 3657
3657 2862
2892 549
549 470
3203 653
3657 1534
1534 4802
4802 1417
470 1370
1...

output:

6
5000 2642
1 4885
2 4736
3 4975
4 1314
5 3463
6 993
9 3904
10 4965
11 3301
12 878
12 1292
12 2081
12 2258
12 3056
13 4579
14 3842
15 4856
17 1756
17 2084
17 2616
17 3885
17 4421
19 2226
20 4008
22 3391
22 4627
24 1188
25 2726
27 1784
27 2088
27 3896
28 345
28 999
28 3258
30 1969
31 1382
33 1936
34 ...

input:

6
5000 2642
1 4885
2 4736
3 4975
4 1314
5 3463
6 993
9 3904
10 4965
11 3301
12 878
12 1292
12 2081
12 2258
12 3056
13 4579
14 3842
15 4856
17 1756
17 2084
17 2616
17 3885
17 4421
19 2226
20 4008
22 3391
22 4627
24 1188
25 2726
27 1784
27 2088
27 3896
28 345
28 999
28 3258
30 1969
31 1382
33 1936
34 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1928kb

input:

5
10955780

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
4462 2892
1567 2346
1567 1833
4462 93
2892 4233
2346 3203
3203 3657
1567 2862
1567 549
3203 470
2346 653
2862 1534
1833 4802
2346 1417
549 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
4462 2892
1567 2346
1567 1833
4462 93
2892 4233
2346 3203
3203 3657
1567 2862
1567 549
3203 470
2346 653
2862 1534
1833 4802
2346 1417
549 1370
...

output:

6
5000 2506
1 772
5 2098
7 166
8 4087
9 4259
10 4819
11 4757
13 4475
14 2346
15 4293
17 4233
18 1392
19 3779
20 1474
21 4071
22 2285
23 3215
25 1125
26 4660
27 1005
28 1349
28 3364
34 2246
35 597
36 4819
40 1552
42 269
44 176
47 1975
49 3505
52 4716
53 2509
54 477
57 1020
58 4109
59 3038
61 1622
62 ...

input:

6
5000 2506
1 772
5 2098
7 166
8 4087
9 4259
10 4819
11 4757
13 4475
14 2346
15 4293
17 4233
18 1392
19 3779
20 1474
21 4071
22 2285
23 3215
25 1125
26 4660
27 1005
28 1349
28 3364
34 2246
35 597
36 4819
40 1552
42 269
44 176
47 1975
49 3505
52 4716
53 2509
54 477
57 1020
58 4109
59 3038
61 1622
62 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1928kb

input:

7
19938721

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
3379 2346
3379 1833
3379 93
1833 4233
3379 3203
2346 3657
3379 2862
1567 549
3379 470
2862 653
1833 1534
3379 4802
3379 1417
1417 1370...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
3379 2346
3379 1833
3379 93
1833 4233
3379 3203
2346 3657
3379 2862
1567 549
3379 470
2862 653
1833 1534
3379 4802
3379 1417
1417 1370...

output:

8
5000 2500
1 4723
2 3529
4 962
4 2953
5 4220
6 1784
9 807
9 1973
11 2903
13 4363
15 1364
15 1586
15 1743
16 2462
16 4940
19 4609
20 3871
21 4237
23 2653
25 1610
26 4122
27 2318
27 4763
28 4212
29 3863
30 711
31 4973
32 3803
33 1474
35 3527
37 3654
38 4276
39 4519
40 4315
43 3212
44 863
46 4339
47 1...

input:

8
5000 2500
1 4723
2 3529
4 962
4 2953
5 4220
6 1784
9 807
9 1973
11 2903
13 4363
15 1364
15 1586
15 1743
16 2462
16 4940
19 4609
20 3871
21 4237
23 2653
25 1610
26 4122
27 2318
27 4763
28 4212
29 3863
30 711
31 4973
32 3803
33 1474
35 3527
37 3654
38 4276
39 4519
40 4315
43 3212
44 863
46 4339
47 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1936kb

input:

7
5129508

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
1567 2892
1567 2346
2892 1833
1567 93
93 4233
2346 3203
2892 3657
3203 2862
2862 549
1567 470
4233 653
93 1534
2892 4802
2346 1417
653 1370
470 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
1567 2892
1567 2346
2892 1833
1567 93
93 4233
2346 3203
2892 3657
3203 2862
2862 549
1567 470
4233 653
93 1534
2892 4802
2346 1417
653 1370
470 ...

output:

8
5000 2500
1 61
1 3547
2 1559
4 1099
4 1355
5 3326
6 1024
6 4391
9 4114
10 1540
11 661
12 4289
13 2520
15 1326
16 2139
19 1851
20 145
21 2539
22 453
22 4655
23 4695
25 2188
26 3035
29 2687
30 84
30 2596
30 2651
30 4588
31 377
32 3752
33 1963
33 3273
33 4450
34 4618
35 4693
36 3657
38 3426
39 4963
4...

input:

8
5000 2500
1 61
1 3547
2 1559
4 1099
4 1355
5 3326
6 1024
6 4391
9 4114
10 1540
11 661
12 4289
13 2520
15 1326
16 2139
19 1851
20 145
21 2539
22 453
22 4655
23 4695
25 2188
26 3035
29 2687
30 84
30 2596
30 2651
30 4588
31 377
32 3752
33 1963
33 3273
33 4450
34 4618
35 4693
36 3657
38 3426
39 4963
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

7
15332941

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
3379 2346
3379 1833
3379 93
3379 4233
1833 3203
3379 3657
3379 2862
3203 549
3379 470
1567 653
3379 1534
3379 4802
653 1417
470 1370
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
3379 2346
3379 1833
3379 93
3379 4233
1833 3203
3379 3657
3379 2862
3203 549
3379 470
1567 653
3379 1534
3379 4802
653 1417
470 1370
3...

output:

8
5000 2500
1 3178
2 859
3 137
3 2419
5 4099
7 2322
8 1262
8 2626
9 3276
11 2247
12 4566
13 3538
14 3980
14 4817
15 1324
15 1925
15 2384
15 2599
16 4697
17 3170
19 1210
20 4893
21 4698
22 4995
23 2598
24 3559
25 2204
26 4022
29 4583
30 86
32 3026
34 3620
36 4856
37 1218
38 1661
38 4280
39 2500
40 61...

input:

8
5000 2500
1 3178
2 859
3 137
3 2419
5 4099
7 2322
8 1262
8 2626
9 3276
11 2247
12 4566
13 3538
14 3980
14 4817
15 1324
15 1925
15 2384
15 2599
16 4697
17 3170
19 1210
20 4893
21 4698
22 4995
23 2598
24 3559
25 2204
26 4022
29 4583
30 86
32 3026
34 3620
36 4856
37 1218
38 1661
38 4280
39 2500
40 61...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1944kb

input:

1
355365355024496523

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
2892 2346
2892 1833
2892 93
1567 4233
2892 3203
2892 3657
2892 2862
2892 549
2892 470
1833 653
4233 1534
2892 4802
549 1417
1534 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
2892 2346
2892 1833
2892 93
1567 4233
2892 3203
2892 3657
2892 2862
2892 549
2892 470
1833 653
4233 1534
2892 4802
549 1417
1534 1370
...

output:

2
5000 3531
1 840
1 4809
4 469
4 1329
4 2366
4 2974
4 3030
4 4187
4 4681
4 4951
5 1341
6 4219
7 3196
8 4836
13 2352
14 2352
14 3795
15 419
15 4498
16 4604
17 2279
17 3367
17 4477
18 1161
18 3410
18 4777
19 2298
21 835
22 3410
24 4665
25 1476
26 1204
27 3752
28 4434
29 1552
29 3996
30 3803
30 3925
31...

input:

2
5000 3531
1 840
1 4809
4 469
4 1329
4 2366
4 2974
4 3030
4 4187
4 4681
4 4951
5 1341
6 4219
7 3196
8 4836
13 2352
14 2352
14 3795
15 419
15 4498
16 4604
17 2279
17 3367
17 4477
18 1161
18 3410
18 4777
19 2298
21 835
22 3410
24 4665
25 1476
26 1204
27 3752
28 4434
29 1552
29 3996
30 3803
30 3925
31...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1952kb

input:

1
727827999106414164

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
1567 2892
1567 2346
2346 1833
1567 93
1567 4233
2346 3203
93 3657
2346 2862
4462 549
1567 470
2862 653
1567 1534
3657 4802
2346 1417
549 1370
93...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
1567 2892
1567 2346
2346 1833
1567 93
1567 4233
2346 3203
93 3657
2346 2862
4462 549
1567 470
2862 653
1567 1534
3657 4802
2346 1417
549 1370
93...

output:

2
5000 3531
1 1803
1 3103
4 2198
4 3095
5 3626
6 3240
8 2312
10 3370
12 185
13 717
14 772
14 2042
14 3038
14 4761
17 1314
17 2460
17 3448
17 4563
18 3836
21 182
22 133
24 984
24 1950
25 1985
27 1147
28 1276
28 2650
28 3305
28 4527
29 740
30 1443
31 1306
33 1896
34 227
34 601
34 1941
34 4355
35 1851
...

input:

2
5000 3531
1 1803
1 3103
4 2198
4 3095
5 3626
6 3240
8 2312
10 3370
12 185
13 717
14 772
14 2042
14 3038
14 4761
17 1314
17 2460
17 3448
17 4563
18 3836
21 182
22 133
24 984
24 1950
25 1985
27 1147
28 1276
28 2650
28 3305
28 4527
29 740
30 1443
31 1306
33 1896
34 227
34 601
34 1941
34 4355
35 1851
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1948kb

input:

1
656410143989222955

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
2892 2346
1567 1833
2892 93
2892 4233
2892 3203
1567 3657
1833 2862
4462 549
2892 470
4233 653
2892 1534
1567 4802
549 1417
3379 1370
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
3379 4462
1567 2892
2892 2346
1567 1833
2892 93
2892 4233
2892 3203
1567 3657
1833 2862
4462 549
2892 470
4233 653
2892 1534
1567 4802
549 1417
3379 1370
...

output:

2
5000 3531
1 571
4 652
4 1980
4 2302
4 3937
5 1599
6 4332
7 390
8 3904
11 2766
13 497
17 1002
17 1369
17 2082
17 3072
17 3207
17 4064
17 4926
17 4945
17 4975
18 1530
21 2309
22 785
22 1259
24 1153
25 4790
27 400
27 2413
27 3123
27 3265
27 4144
27 4219
27 4808
29 1530
30 2610
30 3014
30 4533
31 3694...

input:

2
5000 3531
1 571
4 652
4 1980
4 2302
4 3937
5 1599
6 4332
7 390
8 3904
11 2766
13 497
17 1002
17 1369
17 2082
17 3072
17 3207
17 4064
17 4926
17 4945
17 4975
18 1530
21 2309
22 785
22 1259
24 1153
25 4790
27 400
27 2413
27 3123
27 3265
27 4144
27 4219
27 4808
29 1530
30 2610
30 3014
30 4533
31 3694...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1944kb

input:

1
410366615149657534

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
4462 2346
2346 1833
2346 93
2346 4233
93 3203
2346 3657
2346 2862
1833 549
2862 470
2346 653
2346 1534
2346 4802
1534 1417
4802 1370
2...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
4462 2346
2346 1833
2346 93
2346 4233
93 3203
2346 3657
2346 2862
1833 549
2862 470
2346 653
2346 1534
2346 4802
1534 1417
4802 1370
2...

output:

2
5000 3531
1 3029
4 2236
4 2315
4 3455
4 4259
5 423
5 4826
6 3996
8 2698
12 3236
13 2510
14 1533
14 4544
14 4817
17 2880
18 2820
21 1818
22 2100
24 1808
24 2351
24 3127
25 4439
27 4644
28 2564
28 4546
29 2581
30 2890
30 3788
31 1443
33 390
34 4977
35 1448
35 3570
35 4302
36 786
36 3908
36 4901
37 1...

input:

2
5000 3531
1 3029
4 2236
4 2315
4 3455
4 4259
5 423
5 4826
6 3996
8 2698
12 3236
13 2510
14 1533
14 4544
14 4817
17 2880
18 2820
21 1818
22 2100
24 1808
24 2351
24 3127
25 4439
27 4644
28 2564
28 4546
29 2581
30 2890
30 3788
31 1443
33 390
34 4977
35 1448
35 3570
35 4302
36 786
36 3908
36 4901
37 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1880kb,1944kb

input:

1
298090682780948428

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
1567 2346
2892 1833
2346 93
1567 4233
2346 3203
2346 3657
3203 2862
3203 549
2346 470
4233 653
1567 1534
653 4802
470 1417
1534 1370
2...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1567 3379
1567 4462
3379 2892
1567 2346
2892 1833
2346 93
1567 4233
2346 3203
2346 3657
3203 2862
3203 549
2346 470
4233 653
1567 1534
653 4802
470 1417
1534 1370
2...

output:

2
5000 3531
1 321
5 1043
5 1288
5 2856
6 3326
7 633
8 3505
10 3257
13 1541
14 3663
14 4347
17 2492
18 4264
21 994
22 706
22 2542
22 4131
24 4079
25 1036
25 3706
27 2073
27 2305
27 4499
27 4791
29 962
29 2849
29 3571
29 3934
30 242
30 2083
30 2795
30 2948
31 2050
32 1353
32 2132
34 4890
35 2718
36 49...

input:

2
5000 3531
1 321
5 1043
5 1288
5 2856
6 3326
7 633
8 3505
10 3257
13 1541
14 3663
14 4347
17 2492
18 4264
21 994
22 706
22 2542
22 4131
24 4079
25 1036
25 3706
27 2073
27 2305
27 4499
27 4791
29 962
29 2849
29 3571
29 3934
30 242
30 2083
30 2795
30 2948
31 2050
32 1353
32 2132
34 4890
35 2718
36 49...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

3
969441916331132577

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
1567 2892
3379 2346
4462 1833
2892 93
2346 4233
3379 3203
1567 3657
4233 2862
2892 549
3657 470
3203 653
549 1534
470 4802
3379 1417
1833 1370
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
1567 2892
3379 2346
4462 1833
2892 93
2346 4233
3379 3203
1567 3657
4233 2862
2892 549
3657 470
3203 653
549 1534
470 4802
3379 1417
1833 1370
3...

output:

4
5000 2500
2 2145
2 2937
3 225
4 3170
5 2592
6 456
7 4751
8 4685
9 677
10 2127
10 3518
11 781
12 3759
13 3923
15 662
15 1566
16 156
16 1694
17 1157
17 3490
17 3952
18 4301
19 62
21 3395
22 1557
23 262
25 1583
25 1783
27 1446
27 4189
28 3359
29 2439
30 798
30 1224
30 3435
31 3479
35 2175
37 4832
38 ...

input:

4
5000 2500
2 2145
2 2937
3 225
4 3170
5 2592
6 456
7 4751
8 4685
9 677
10 2127
10 3518
11 781
12 3759
13 3923
15 662
15 1566
16 156
16 1694
17 1157
17 3490
17 3952
18 4301
19 62
21 3395
22 1557
23 262
25 1583
25 1783
27 1446
27 4189
28 3359
29 2439
30 798
30 1224
30 3435
31 3479
35 2175
37 4832
38 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1880kb,1932kb

input:

3
929489812741933634

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
4462 2892
4462 2346
2346 1833
4462 93
4462 4233
4462 3203
4462 3657
2346 2862
2346 549
4462 470
3657 653
4462 1534
1534 4802
4462 1417
1567 1370...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
4462 2892
4462 2346
2346 1833
4462 93
4462 4233
4462 3203
4462 3657
2346 2862
2346 549
4462 470
3657 653
4462 1534
1534 4802
4462 1417
1567 1370...

output:

4
5000 2500
2 2177
5 1094
5 1521
5 2715
5 3590
6 4236
8 1553
9 471
10 4467
11 3190
12 2616
16 1824
17 3768
19 4479
20 866
21 760
23 353
24 1347
24 3013
24 3511
24 3561
24 4944
25 1209
26 4019
28 3630
29 3642
30 4100
31 85
33 2637
34 2694
36 2591
37 3954
38 4896
39 503
39 1012
42 3020
43 2543
45 2053...

input:

4
5000 2500
2 2177
5 1094
5 1521
5 2715
5 3590
6 4236
8 1553
9 471
10 4467
11 3190
12 2616
16 1824
17 3768
19 4479
20 866
21 760
23 353
24 1347
24 3013
24 3511
24 3561
24 4944
25 1209
26 4019
28 3630
29 3642
30 4100
31 85
33 2637
34 2694
36 2591
37 3954
38 4896
39 503
39 1012
42 3020
43 2543
45 2053...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1936kb

input:

3
144032041325838295

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
3379 2892
2892 2346
1567 1833
3379 93
1567 4233
4233 3203
3379 3657
1833 2862
2892 549
4233 470
93 653
4233 1534
2862 4802
4233 1417
3657 1370
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
3379 2892
2892 2346
1567 1833
3379 93
1567 4233
4233 3203
3379 3657
1833 2862
2892 549
4233 470
93 653
4233 1534
2862 4802
4233 1417
3657 1370
3...

output:

4
5000 2500
2 4424
4 322
4 573
4 635
4 3035
5 2367
5 3330
6 1077
7 1691
9 668
11 1683
12 1130
12 2264
13 597
13 3135
16 1983
17 176
17 1868
21 4676
23 3376
24 4276
25 1839
26 3021
27 1969
30 1573
30 2191
30 2647
34 389
36 2248
36 2608
36 4544
36 4817
37 1028
40 1143
41 383
41 638
41 4606
41 4643
43 ...

input:

4
5000 2500
2 4424
4 322
4 573
4 635
4 3035
5 2367
5 3330
6 1077
7 1691
9 668
11 1683
12 1130
12 2264
13 597
13 3135
16 1983
17 176
17 1868
21 4676
23 3376
24 4276
25 1839
26 3021
27 1969
30 1573
30 2191
30 2647
34 389
36 2248
36 2608
36 4544
36 4817
37 1028
40 1143
41 383
41 638
41 4606
41 4643
43 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1880kb,1932kb

input:

3
832110946250826180

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
1567 2892
1567 2346
1567 1833
1567 93
3379 4233
2346 3203
2892 3657
1567 2862
2346 549
1567 470
2892 653
3203 1534
1567 4802
2346 1417
4462 1370...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
1567 4462
1567 2892
1567 2346
1567 1833
1567 93
3379 4233
2346 3203
2892 3657
1567 2862
2346 549
1567 470
2892 653
3203 1534
1567 4802
2346 1417
4462 1370...

output:

4
5000 2500
1 3928
2 689
3 1030
6 4339
7 146
8 1638
8 2612
9 3494
13 4727
14 1225
14 2280
14 2525
15 3755
16 1011
17 3136
20 3201
21 918
23 1193
23 2690
25 1396
26 2181
28 504
28 1402
28 1739
29 3077
29 3725
29 4500
30 1210
30 2417
31 2353
35 531
37 2535
38 2886
39 1637
40 608
40 1571
40 2984
44 419...

input:

4
5000 2500
1 3928
2 689
3 1030
6 4339
7 146
8 1638
8 2612
9 3494
13 4727
14 1225
14 2280
14 2525
15 3755
16 1011
17 3136
20 3201
21 918
23 1193
23 2690
25 1396
26 2181
28 504
28 1402
28 1739
29 3077
29 3725
29 4500
30 1210
30 2417
31 2353
35 531
37 2535
38 2886
39 1637
40 608
40 1571
40 2984
44 419...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1936kb

input:

3
85728715707691821

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
1567 2892
3379 2346
3379 1833
2892 93
4462 4233
1833 3203
2892 3657
3379 2862
93 549
3657 470
549 653
3657 1534
93 4802
653 1417
653 1370
2892 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1567 3379
3379 4462
1567 2892
3379 2346
3379 1833
2892 93
4462 4233
1833 3203
2892 3657
3379 2862
93 549
3657 470
549 653
3657 1534
93 4802
653 1417
653 1370
2892 3...

output:

4
5000 2500
2 308
5 1148
6 2591
9 1579
9 1885
11 2874
12 3332
13 3417
15 2215
15 2277
15 2650
15 4129
16 2848
16 4048
17 624
17 2098
17 2270
17 2874
18 4107
19 4862
20 409
22 4054
23 4765
24 1399
24 4332
25 979
25 2872
25 3993
26 2886
27 2365
27 3400
28 375
29 1601
30 646
32 3840
36 4536
37 2676
38 ...

input:

4
5000 2500
2 308
5 1148
6 2591
9 1579
9 1885
11 2874
12 3332
13 3417
15 2215
15 2277
15 2650
15 4129
16 2848
16 4048
17 624
17 2098
17 2270
17 2874
18 4107
19 4862
20 409
22 4054
23 4765
24 1399
24 4332
25 979
25 2872
25 3993
26 2886
27 2365
27 3400
28 375
29 1601
30 646
32 3840
36 4536
37 2676
38 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

5
777434612360931036

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
3379 1833
1567 93
3379 4233
2346 3203
1567 3657
93 2862
93 549
1567 470
1833 653
3203 1534
93 4802
470 1417
653 1370
1567 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
3379 1833
1567 93
3379 4233
2346 3203
1567 3657
93 2862
93 549
1567 470
1833 653
3203 1534
93 4802
470 1417
653 1370
1567 33...

output:

6
5000 2509
1 2735
3 1846
5 3603
6 2558
7 4009
8 2294
11 612
12 4221
13 1590
14 1808
14 2953
14 4520
15 1374
15 3619
16 1385
19 2915
21 3795
23 1592
24 1793
24 3401
24 4778
25 2968
28 1277
29 2140
29 4479
30 2216
32 2336
33 1764
35 4966
36 4193
37 4828
39 1072
40 3610
41 3987
43 301
44 2671
45 1400
...

input:

6
5000 2509
1 2735
3 1846
5 3603
6 2558
7 4009
8 2294
11 612
12 4221
13 1590
14 1808
14 2953
14 4520
15 1374
15 3619
16 1385
19 2915
21 3795
23 1592
24 1793
24 3401
24 4778
25 2968
28 1277
29 2140
29 4479
30 2216
32 2336
33 1764
35 4966
36 4193
37 4828
39 1072
40 3610
41 3987
43 301
44 2671
45 1400
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1932kb

input:

5
705262511549880222

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
4462 2346
4462 1833
1567 93
3379 4233
93 3203
93 3657
4462 2862
2346 549
93 470
2892 653
3203 1534
470 4802
1534 1417
1534 1370
93 337...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
4462 2346
4462 1833
1567 93
3379 4233
93 3203
93 3657
4462 2862
2346 549
93 470
2892 653
3203 1534
470 4802
1534 1417
1534 1370
93 337...

output:

6
5000 2527
1 419
1 1208
1 2378
1 2781
1 3423
1 3543
1 4048
1 4498
1 4792
1 4866
3 4657
4 3170
6 3170
8 3830
10 109
12 4743
13 2377
14 3170
15 2983
16 1875
17 4462
18 3892
20 3921
21 3321
22 485
24 4047
25 1113
26 3539
29 2818
30 1371
32 2874
35 4657
36 3323
40 3898
41 2173
46 4562
47 2087
48 2210
4...

input:

6
5000 2527
1 419
1 1208
1 2378
1 2781
1 3423
1 3543
1 4048
1 4498
1 4792
1 4866
3 4657
4 3170
6 3170
8 3830
10 109
12 4743
13 2377
14 3170
15 2983
16 1875
17 4462
18 3892
20 3921
21 3321
22 485
24 4047
25 1113
26 3539
29 2818
30 1371
32 2874
35 4657
36 3323
40 3898
41 2173
46 4562
47 2087
48 2210
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1888kb,1932kb

input:

5
510318082834167951

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
3379 4462
1567 2892
2892 2346
3379 1833
2892 93
1567 4233
4233 3203
1567 3657
3379 2862
4462 549
2892 470
1833 653
4233 1534
93 4802
4802 1417
1417 1370
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
3379 4462
1567 2892
2892 2346
3379 1833
2892 93
1567 4233
4233 3203
1567 3657
3379 2862
4462 549
2892 470
1833 653
4233 1534
93 4802
4802 1417
1417 1370
3...

output:

6
5000 2540
1 3922
3 193
4 1113
4 1389
4 2047
4 2790
4 2808
4 2876
4 3508
4 3532
7 3882
8 2792
9 3882
13 1361
14 4802
15 2610
15 3139
15 4533
16 4216
17 310
17 333
17 807
17 1061
17 1078
17 1544
17 2211
17 2399
17 3536
17 3908
17 4247
17 4613
17 4918
19 4987
20 4884
22 996
23 278
26 2759
27 2235
28 ...

input:

6
5000 2540
1 3922
3 193
4 1113
4 1389
4 2047
4 2790
4 2808
4 2876
4 3508
4 3532
7 3882
8 2792
9 3882
13 1361
14 4802
15 2610
15 3139
15 4533
16 4216
17 310
17 333
17 807
17 1061
17 1078
17 1544
17 2211
17 2399
17 3536
17 3908
17 4247
17 4613
17 4918
19 4987
20 4884
22 996
23 278
26 2759
27 2235
28 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1932kb

input:

5
914858813253258744

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
2346 1833
1567 93
2892 4233
1567 3203
93 3657
2346 2862
4462 549
1567 470
1567 653
2862 1534
3657 4802
3203 1417
2346 1370
9...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
1567 2892
1567 2346
2346 1833
1567 93
2892 4233
1567 3203
93 3657
2346 2862
4462 549
1567 470
1567 653
2862 1534
3657 4802
3203 1417
2346 1370
9...

output:

6
5000 2541
1 2483
3 3203
5 4696
10 2157
11 4223
12 3776
13 459
14 1665
17 269
17 609
17 1493
17 1625
17 2093
17 4199
17 4209
20 2335
22 85
23 3684
24 1449
27 439
29 994
30 3235
31 1076
32 258
34 561
35 849
36 1934
37 2909
38 4046
39 4331
40 4569
42 4738
43 1932
44 3422
45 3447
47 3951
48 299
50 828...

input:

6
5000 2541
1 2483
3 3203
5 4696
10 2157
11 4223
12 3776
13 459
14 1665
17 269
17 609
17 1493
17 1625
17 2093
17 4199
17 4209
20 2335
22 85
23 3684
24 1449
27 439
29 994
30 3235
31 1076
32 258
34 561
35 849
36 1934
37 2909
38 4046
39 4331
40 4569
42 4738
43 1932
44 3422
45 3447
47 3951
48 299
50 828...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1936kb

input:

5
659635316746638238

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
3379 2892
4462 2346
2892 1833
2346 93
93 4233
93 3203
3379 3657
3203 2862
93 549
2862 470
93 653
93 1534
653 4802
1534 1417
2346 1370
2862 3374
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1567 3379
1567 4462
3379 2892
4462 2346
2892 1833
2346 93
93 4233
93 3203
3379 3657
3203 2862
93 549
2862 470
93 653
93 1534
653 4802
1534 1417
2346 1370
2862 3374
...

output:

6
5000 2529
1 93
2 3946
3 487
3 1565
3 3413
3 4891
4 3779
5 1035
6 607
7 1471
7 2134
7 2343
7 2512
7 3841
7 4138
8 1143
10 1405
12 3367
14 3170
15 1622
16 3411
22 1408
26 442
27 35
27 2772
28 3052
29 4850
30 2296
31 622
34 314
36 3613
37 1170
40 1103
41 1625
42 314
43 1054
43 2793
44 855
46 3998
47 ...

input:

6
5000 2529
1 93
2 3946
3 487
3 1565
3 3413
3 4891
4 3779
5 1035
6 607
7 1471
7 2134
7 2343
7 2512
7 3841
7 4138
8 1143
10 1405
12 3367
14 3170
15 1622
16 3411
22 1408
26 442
27 35
27 2772
28 3052
29 4850
30 2296
31 622
34 314
36 3613
37 1170
40 1103
41 1625
42 314
43 1054
43 2793
44 855
46 3998
47 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1936kb

input:

7
858490260563149759

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
2892 2346
2346 1833
3379 93
93 4233
4233 3203
3379 3657
3657 2862
93 549
4233 470
470 653
653 1534
2346 4802
4802 1417
1534 1370
3379 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
3379 2892
2892 2346
2346 1833
3379 93
93 4233
4233 3203
3379 3657
3657 2862
93 549
4233 470
470 653
653 1534
2346 4802
4802 1417
1534 1370
3379 ...

output:

8
5000 2500
1 4495
1 4705
2 3905
3 977
5 3820
6 2758
8 4790
9 1418
10 2720
11 4128
12 3315
13 1366
13 4204
16 1797
17 1504
19 143
20 1803
21 877
22 2878
23 43
24 1979
25 121
26 2753
27 2880
28 123
29 2522
29 3066
29 3486
29 3533
29 4467
30 1153
30 1630
32 404
32 1093
32 4398
32 4601
34 104
35 1803
3...

input:

8
5000 2500
1 4495
1 4705
2 3905
3 977
5 3820
6 2758
8 4790
9 1418
10 2720
11 4128
12 3315
13 1366
13 4204
16 1797
17 1504
19 143
20 1803
21 877
22 2878
23 43
24 1979
25 121
26 2753
27 2880
28 123
29 2522
29 3066
29 3486
29 3533
29 4467
30 1153
30 1630
32 404
32 1093
32 4398
32 4601
34 104
35 1803
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1928kb

input:

7
860058643727731209

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
1567 2892
3379 2346
2346 1833
2892 93
93 4233
3379 3203
93 3657
3657 2862
2892 549
3657 470
3203 653
653 1534
3657 4802
3657 1417
93 1370
4802 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
1567 2892
3379 2346
2346 1833
2892 93
93 4233
3379 3203
93 3657
3657 2862
2892 549
3657 470
3203 653
653 1534
3657 4802
3657 1417
93 1370
4802 3...

output:

8
5000 2500
1 3155
2 2123
3 1536
3 4321
5 2130
6 1054
7 4110
10 3735
11 3212
12 4875
13 646
15 254
15 4017
15 4040
16 1414
19 2171
20 2616
21 2701
23 4885
25 2152
26 265
29 826
30 2171
31 2365
32 1213
33 3018
34 573
34 2419
35 4153
37 3732
38 1390
39 1505
41 1305
42 2404
42 3295
43 3197
44 272
45 49...

input:

8
5000 2500
1 3155
2 2123
3 1536
3 4321
5 2130
6 1054
7 4110
10 3735
11 3212
12 4875
13 646
15 254
15 4017
15 4040
16 1414
19 2171
20 2616
21 2701
23 4885
25 2152
26 265
29 826
30 2171
31 2365
32 1213
33 3018
34 573
34 2419
35 4153
37 3732
38 1390
39 1505
41 1305
42 2404
42 3295
43 3197
44 272
45 49...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1928kb

input:

7
718861404514377808

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
3379 2892
1567 2346
2892 1833
2346 93
1833 4233
1567 3203
3379 3657
3203 2862
4462 549
2346 470
3203 653
470 1534
653 4802
1567 1417
470 1370
28...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
3379 2892
1567 2346
2892 1833
2346 93
1833 4233
1567 3203
3379 3657
3203 2862
4462 549
2346 470
3203 653
470 1534
653 4802
1567 1417
470 1370
28...

output:

8
5000 2500
1 1052
2 2014
3 327
4 218
5 3087
6 1048
7 1950
7 2325
7 3200
8 4290
9 966
10 1385
11 4542
13 950
14 2326
14 4876
15 3074
15 4474
16 1619
19 3674
20 670
21 1680
22 452
23 1106
24 2120
25 1359
26 423
27 316
27 2359
27 2774
27 3507
29 137
30 679
30 1205
30 3382
31 1030
34 4455
35 413
35 983...

input:

8
5000 2500
1 1052
2 2014
3 327
4 218
5 3087
6 1048
7 1950
7 2325
7 3200
8 4290
9 966
10 1385
11 4542
13 950
14 2326
14 4876
15 3074
15 4474
16 1619
19 3674
20 670
21 1680
22 452
23 1106
24 2120
25 1359
26 423
27 316
27 2359
27 2774
27 3507
29 137
30 679
30 1205
30 3382
31 1030
34 4455
35 413
35 983...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1884kb,1936kb

input:

7
659192688464047828

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
3379 2892
1567 2346
2892 1833
2346 93
93 4233
2346 3203
4233 3657
3203 2862
4462 549
2346 470
470 653
93 1534
653 4802
2346 1417
93 1370
1417 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
1567 4462
3379 2892
1567 2346
2892 1833
2346 93
93 4233
2346 3203
4233 3657
3203 2862
4462 549
2346 470
470 653
93 1534
653 4802
2346 1417
93 1370
1417 33...

output:

8
5000 2500
1 3855
1 3941
2 624
4 2213
4 4817
5 1203
6 3509
7 1400
8 4597
9 1550
11 3698
12 1615
13 868
14 738
14 4664
16 4808
17 175
18 227
19 4809
20 4521
21 3284
23 2144
23 3580
24 2356
25 2731
26 2313
27 160
27 1210
27 1444
27 4665
28 2183
29 366
29 505
30 3490
31 1511
32 750
34 2276
35 4229
36 ...

input:

8
5000 2500
1 3855
1 3941
2 624
4 2213
4 4817
5 1203
6 3509
7 1400
8 4597
9 1550
11 3698
12 1615
13 868
14 738
14 4664
16 4808
17 175
18 227
19 4809
20 4521
21 3284
23 2144
23 3580
24 2356
25 2731
26 2313
27 160
27 1210
27 1444
27 4665
28 2183
29 366
29 505
30 3490
31 1511
32 750
34 2276
35 4229
36 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1888kb,1932kb

input:

7
685730986714800201

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
1567 2892
3379 2346
3379 1833
2892 93
1567 4233
3379 3203
2892 3657
3379 2862
2862 549
3657 470
93 653
4233 1534
93 4802
3657 1417
4233 1370
289...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1567 3379
3379 4462
1567 2892
3379 2346
3379 1833
2892 93
1567 4233
3379 3203
2892 3657
3379 2862
2862 549
3657 470
93 653
4233 1534
93 4802
3657 1417
4233 1370
289...

output:

8
5000 2500
2 1646
3 1936
4 2975
5 1036
6 2101
11 3219
13 4246
14 4563
15 4740
16 4633
21 4299
23 3051
24 3359
25 1472
26 488
28 3093
29 4999
30 3030
31 3467
32 1197
33 754
33 2733
35 1530
36 3673
36 3757
36 4107
37 2056
38 1268
39 89
40 3762
41 3575
42 2815
42 3103
43 3832
44 1479
45 3163
46 77
47 ...

input:

8
5000 2500
2 1646
3 1936
4 2975
5 1036
6 2101
11 3219
13 4246
14 4563
15 4740
16 4633
21 4299
23 3051
24 3359
25 1472
26 488
28 3093
29 4999
30 3030
31 3467
32 1197
33 754
33 2733
35 1530
36 3673
36 3757
36 4107
37 2056
38 1268
39 89
40 3762
41 3575
42 2815
42 3103
43 3832
44 1479
45 3163
46 77
47 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201