QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#668818#8726. Magic Show_Alexande_100 ✓5ms32956kbC++142.6kb2024-10-23 16:07:312024-10-23 16:07:32

Judging History

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

  • [2024-10-23 16:07:32]
  • 评测
  • 测评结果:100
  • 用时:5ms
  • 内存:32956kb
  • [2024-10-23 16:07:31]
  • 提交

Alice

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

using namespace std;
mt19937 rnd1 ( 114514 ), rnd2 ( 191981 ), rnd3 ( 998244 );

const int N = 5005;

int n = 5000;
int rd[N], dad1[N], dad2[N];
vector < pair < int, int > > e;

vector < pair < int, int > > Alice () {
	long long x = setN ( 5000 );
    for ( int i = 1; i <= n; i ++ ) {
        rd[i] = i;
    }
    srand ( rnd3 () );
    random_shuffle ( rd + 1, rd + 1 + n );
	for ( int i = 3; i <= n; i ++ ) {
        dad1[i] = rnd1 () % ( i - 1 ) + 1;
        dad2[i] = rnd2 () % ( i - 1 ) + 1;
        while ( dad2[i] == dad1[i] ) {
            dad2[i] = rnd2 () % ( i - 1 ) + 1;
        }
    }
    for ( int i = 2; i <= 80; i ++ ) {
        e.push_back ( { i, rnd3 () % ( i - 1 ) + 1 } );
    }
    int len = 80;
    for ( int i = 1; i <= 80; i ++ ) {
        for ( int j = 0; j <= 60; j ++ ) {
            len ++;
            if ( ( x >> ( long long ) j ) & 1ll ) {
                e.push_back ( { len, dad1[len] } );
            }
            else {
                e.push_back ( { len, dad2[len] } );
            }
        }
    }
    for ( int i = len + 1; i <= 5000; i ++ ) {
        e.push_back ( { i, rnd3 () % ( i - 1 ) + 1 } );
    }
    vector < pair < int, int > > ans;
    for ( pair < int, int > tmp : e ) {
        ans.push_back ( { rd[tmp.first], rd[tmp.second] } );
    }
    return ans;
}

Bob

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

using namespace std;
mt19937 rndd1 ( 114514 ), rndd2 ( 191981 ), rndd3 ( 998244 );

const int N = 5005;

int nn = 5000;
int rdd[N], dadd1[N], dadd2[N], id[N];
int mp[N][N], p[N];

long long Bob ( vector < pair < int, int > > e ) {
    for ( int i = 1; i <= nn; i ++ ) {
        rdd[i] = i;
    }
    srand ( rndd3 () );
    random_shuffle ( rdd + 1, rdd + 1 + nn );
    for ( int i = 1; i <= nn; i ++ ) {
        id[rdd[i]] = i;
    }
	for ( int i = 3; i <= nn; i ++ ) {
        dadd1[i] = rndd1 () % ( i - 1 ) + 1;
        dadd2[i] = rndd2 () % ( i - 1 ) + 1;
        while ( dadd2[i] == dadd1[i] ) {
            dadd2[i] = rndd2 () % ( i - 1 ) + 1;
        }
    }
    for ( pair < int, int > tmp : e ) {
        mp[id[tmp.first]][id[tmp.second]] = mp[id[tmp.second]][id[tmp.first]] = 1;
    }
    int len = 80;
    for ( int i = 1; i <= 80; i ++ ) {
        for ( int j = 0; j <= 60; j ++ ) {
            len ++;
            if ( mp[len][dadd1[len]] ) {
                p[j] = 1;
            }
        }
    }
    long long x = 0;
    for ( int i = 0; i <= 60; i ++ ) {
        if ( p[i] ) {
            x += 1ll << ( long long ) i;
        }
    }
	return x;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

1
4005

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1842
7 1537
7 3550
8 1804
9 4078
10 3630
11 2683
12 2564
12 3473
12 4723
12 4780
13 164
13 499
14 969
15 1419
15 4440
16 3627
16 3694
17 2473
17 3966
18 3787
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 2768
25 3601
2...

input:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1842
7 1537
7 3550
8 1804
9 4078
10 3630
11 2683
12 2564
12 3473
12 4723
12 4780
13 164
13 499
14 969
15 1419
15 4440
16 3627
16 3694
17 2473
17 3966
18 3787
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 2768
25 3601
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

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

input:

1
459

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
9 641
10 3630
11 2683
12 2564
12 3473
12 4723
12 4780
13 164
13 499
14 969
15 1419
15 4440
16 3627
17 244
17 3966
18 3787
18 4541
19 228
19 3305
20 1044
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 2768
25 3601
26 ...

input:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
9 641
10 3630
11 2683
12 2564
12 3473
12 4723
12 4780
13 164
13 499
14 969
15 1419
15 4440
16 3627
17 244
17 3966
18 3787
18 4541
19 228
19 3305
20 1044
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 2768
25 3601
26 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

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

input:

1
2495

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
9 641
10 3630
11 2683
12 2564
12 3473
12 4723
12 4780
13 164
13 499
14 969
15 1419
15 4440
16 3627
16 3694
17 2473
17 3966
18 3787
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 2768
25 3601
26...

input:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
9 641
10 3630
11 2683
12 2564
12 3473
12 4723
12 4780
13 164
13 499
14 969
15 1419
15 4440
16 3627
16 3694
17 2473
17 3966
18 3787
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 2768
25 3601
26...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

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

input:

3
1560

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
6 1118
7 1537
7 3550
8 1804
9 4078
10 3630
13 164
13 499
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
18 4541
19 228
19 3305
20 1044
21 2296
25 2768
25 3317
26 1147
27 638
28 2005
28 3524
30 4424
31 374
32 4782
35 3502
36 3619
37 2141
38...

input:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
6 1118
7 1537
7 3550
8 1804
9 4078
10 3630
13 164
13 499
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
18 4541
19 228
19 3305
20 1044
21 2296
25 2768
25 3317
26 1147
27 638
28 2005
28 3524
30 4424
31 374
32 4782
35 3502
36 3619
37 2141
38...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32844kb

input:

3
3594

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
6 1118
7 1537
7 3550
8 1804
9 4078
10 3630
12 4723
12 4780
13 164
13 499
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
18 4541
19 228
19 3305
21 2296
24 4747
25 2768
25 3317
26 1147
27 638
28 1558
28 3524
30 4424
31 374
32 4782
35 3502
36...

input:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
6 1118
7 1537
7 3550
8 1804
9 4078
10 3630
12 4723
12 4780
13 164
13 499
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
18 4541
19 228
19 3305
21 2296
24 4747
25 2768
25 3317
26 1147
27 638
28 1558
28 3524
30 4424
31 374
32 4782
35 3502
36...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1956kb,32840kb

input:

3
1750

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
7 1537
7 3550
8 1804
9 4078
10 3630
12 4723
12 4780
13 164
13 499
15 1419
15 4440
16 3627
17 3966
18 3787
18 4541
19 228
19 3305
20 1044
21 2296
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 2005
28 3524
30 4424
31 374
31 2948
32 4782
35 3502
...

input:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
7 1537
7 3550
8 1804
9 4078
10 3630
12 4723
12 4780
13 164
13 499
15 1419
15 4440
16 3627
17 3966
18 3787
18 4541
19 228
19 3305
20 1044
21 2296
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 2005
28 3524
30 4424
31 374
31 2948
32 4782
35 3502
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1956kb,32792kb

input:

5
4878

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2517
1 1909
2 4468
4 4100
5 2208
7 3550
8 1804
12 2564
12 4723
13 164
14 969
15 4440
16 4212
17 2473
18 4541
19 228
20 1044
21 2296
22 811
23 899
23 4340
24 4747
25 2768
25 3317
28 2005
29 1024
32 4782
33 643
33 1122
33 4382
34 155
34 398
34 932
34 3068
34 4436
35 625
36 3619
38 4411
40 4088
...

input:

6
5000 2517
1 1909
2 4468
4 4100
5 2208
7 3550
8 1804
12 2564
12 4723
13 164
14 969
15 4440
16 4212
17 2473
18 4541
19 228
20 1044
21 2296
22 811
23 899
23 4340
24 4747
25 2768
25 3317
28 2005
29 1024
32 4782
33 643
33 1122
33 4382
34 155
34 398
34 932
34 3068
34 4436
35 625
36 3619
38 4411
40 4088
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32800kb

input:

5
1223

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2525
1 1909
2 489
4 4100
5 2208
7 3550
8 1804
12 2564
12 3473
12 4723
13 164
14 969
15 4440
16 4212
17 3966
18 4541
19 228
20 1044
21 2296
22 811
23 899
23 1847
23 4340
24 4747
25 2768
25 3317
26 4352
28 2005
29 1024
31 2948
32 4782
33 643
33 1122
33 4382
34 2565
35 625
36 3619
40 4088
41 358...

input:

6
5000 2525
1 1909
2 489
4 4100
5 2208
7 3550
8 1804
12 2564
12 3473
12 4723
13 164
14 969
15 4440
16 4212
17 3966
18 4541
19 228
20 1044
21 2296
22 811
23 899
23 1847
23 4340
24 4747
25 2768
25 3317
26 4352
28 2005
29 1024
31 2948
32 4782
33 643
33 1122
33 4382
34 2565
35 625
36 3619
40 4088
41 358...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32808kb

input:

5
648

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2539
1 2412
2 489
4 4100
5 2208
7 1537
8 1804
11 2683
12 2564
12 4723
13 164
14 969
15 4440
16 4212
17 3966
18 4541
19 228
20 1044
21 2296
22 811
23 899
23 1847
23 4340
24 4747
25 2768
25 3317
26 4352
28 3524
29 1024
31 2948
32 4782
33 643
33 1122
33 4382
34 4571
35 625
36 3619
40 4088
41 358...

input:

6
5000 2539
1 2412
2 489
4 4100
5 2208
7 1537
8 1804
11 2683
12 2564
12 4723
13 164
14 969
15 4440
16 4212
17 3966
18 4541
19 228
20 1044
21 2296
22 811
23 899
23 1847
23 4340
24 4747
25 2768
25 3317
26 4352
28 3524
29 1024
31 2948
32 4782
33 643
33 1122
33 4382
34 4571
35 625
36 3619
40 4088
41 358...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32884kb

input:

7
4475

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
6 1118
7 3550
8 1804
9 641
10 3630
11 2683
12 3473
13 164
15 1419
15 4440
16 3627
17 244
17 3966
18 3787
20 1044
21 2296
23 899
23 4340
24 4747
25 2768
25 3317
26 1147
27 638
28 3524
30 4424
31 2075
32 4782
33 643
35 3502
36 3619
37 2141
38...

input:

8
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
6 1118
7 3550
8 1804
9 641
10 3630
11 2683
12 3473
13 164
15 1419
15 4440
16 3627
17 244
17 3966
18 3787
20 1044
21 2296
23 899
23 4340
24 4747
25 2768
25 3317
26 1147
27 638
28 3524
30 4424
31 2075
32 4782
33 643
35 3502
36 3619
37 2141
38...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32888kb

input:

7
4240

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
7 3550
8 1804
9 641
10 3630
11 2683
13 164
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
19 228
20 1044
21 2296
23 899
23 4340
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 3524
30 4424
31 374
31 2948
32 4782
33 643
35 3502
36 ...

input:

8
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
7 3550
8 1804
9 641
10 3630
11 2683
13 164
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
19 228
20 1044
21 2296
23 899
23 4340
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 3524
30 4424
31 374
31 2948
32 4782
33 643
35 3502
36 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 4ms = 1ms + 3ms
memory: 1952kb,32884kb

input:

7
1291

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 1909
1 2412
2 489
3 1931
5 2208
6 1118
7 3550
8 1804
9 4078
10 3630
13 164
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
20 1044
21 2296
23 899
23 4340
24 4747
25 3317
26 1147
27 638
28 3524
30 4424
31 374
32 4782
33 643
33 1122
33 4382
35 3502
36 3619
37 2141
38 4411
39 4382
...

input:

8
5000 2500
1 1909
1 2412
2 489
3 1931
5 2208
6 1118
7 3550
8 1804
9 4078
10 3630
13 164
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
20 1044
21 2296
23 899
23 4340
24 4747
25 3317
26 1147
27 638
28 3524
30 4424
31 374
32 4782
33 643
33 1122
33 4382
35 3502
36 3619
37 2141
38 4411
39 4382
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32948kb

input:

1
17476204

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 416
1 1909
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
9 641
10 3630
11 2683
12 2564
12 4723
12 4780
13 164
13 499
14 969
15 4440
16 3627
17 2473
17 3966
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 1847
23 4297
24 4747
25 2768
25 3601
27 638
28 1558
29 1024
30 4424
32 4...

input:

2
5000 4527
1 416
1 1909
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
9 641
10 3630
11 2683
12 2564
12 4723
12 4780
13 164
13 499
14 969
15 4440
16 3627
17 2473
17 3966
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 1847
23 4297
24 4747
25 2768
25 3601
27 638
28 1558
29 1024
30 4424
32 4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32944kb

input:

1
11926600

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2923
6 1118
7 1537
7 2970
8 1804
8 3070
9 4078
10 3630
11 2918
12 2564
12 3407
12 4723
12 4780
13 164
13 1138
14 969
15 4440
16 3627
17 244
17 3966
18 3787
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 1847
23 4297
23 4340
24 4747
25 2768
25 3601
27...

input:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2923
6 1118
7 1537
7 2970
8 1804
8 3070
9 4078
10 3630
11 2918
12 2564
12 3407
12 4723
12 4780
13 164
13 1138
14 969
15 4440
16 3627
17 244
17 3966
18 3787
18 4541
19 228
19 3305
20 3255
21 2296
22 811
23 1847
23 4297
23 4340
24 4747
25 2768
25 3601
27...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32948kb

input:

1
16602378

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2923
6 1118
7 1537
7 2970
8 1804
8 3070
9 4078
10 3630
11 2918
12 2564
12 3407
12 4723
12 4780
13 164
13 1138
14 969
15 1419
15 4440
16 3627
16 3694
17 244
17 651
17 3966
18 4541
19 228
19 3305
20 1044
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 ...

input:

2
5000 4527
1 1909
1 2412
2 489
3 1931
4 4100
5 2923
6 1118
7 1537
7 2970
8 1804
8 3070
9 4078
10 3630
11 2918
12 2564
12 3407
12 4723
12 4780
13 164
13 1138
14 969
15 1419
15 4440
16 3627
16 3694
17 244
17 651
17 3966
18 4541
19 228
19 3305
20 1044
20 3255
21 2296
22 811
23 4297
23 4340
24 4747
25 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 5ms = 1ms + 4ms
memory: 1952kb,32852kb

input:

3
13129243

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
6 1118
7 1537
7 3550
8 1804
8 3070
9 4078
10 3630
13 164
13 1138
14 969
15 1419
15 4440
16 3627
16 3694
17 244
17 651
17 3966
18 4541
19 228
19 3305
20 1044
21 2296
25 2768
25 3317
26 1147
27 638
28 2005
28 3524
30 4424
31 374
31 2075
32 4782
35 3...

input:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
5 2208
6 1118
7 1537
7 3550
8 1804
8 3070
9 4078
10 3630
13 164
13 1138
14 969
15 1419
15 4440
16 3627
16 3694
17 244
17 651
17 3966
18 4541
19 228
19 3305
20 1044
21 2296
25 2768
25 3317
26 1147
27 638
28 2005
28 3524
30 4424
31 374
31 2075
32 4782
35 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

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

input:

3
7892141

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
6 1118
7 1537
7 2970
7 3550
8 1804
8 3070
9 4078
10 3630
11 2918
13 164
13 1138
15 1419
15 4440
16 3627
16 3694
17 651
17 3966
18 4541
19 228
19 3305
21 2296
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 1558
28 3524
30 4424
31 374
31 2...

input:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
6 1118
7 1537
7 2970
7 3550
8 1804
8 3070
9 4078
10 3630
11 2918
13 164
13 1138
15 1419
15 4440
16 3627
16 3694
17 651
17 3966
18 4541
19 228
19 3305
21 2296
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 1558
28 3524
30 4424
31 374
31 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32852kb

input:

3
21314775

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2923
7 1537
8 1804
9 4078
10 3630
11 2683
13 164
13 499
15 1419
15 4440
16 3627
17 651
17 2473
17 3966
18 3787
18 4541
19 228
19 3305
21 2296
23 899
23 1847
23 4297
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 1558
28 3524
31 374
31 2075
31...

input:

4
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2923
7 1537
8 1804
9 4078
10 3630
11 2683
13 164
13 499
15 1419
15 4440
16 3627
17 651
17 2473
17 3966
18 3787
18 4541
19 228
19 3305
21 2296
23 899
23 1847
23 4297
24 4747
25 2768
25 3317
26 1147
26 4352
27 638
28 1558
28 3524
31 374
31 2075
31...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1956kb,32772kb

input:

5
5559540

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2504
1 2412
2 4468
3 1931
4 4100
7 2970
8 1804
9 4078
12 2564
12 4723
13 164
15 4440
16 4212
17 2473
18 4541
19 228
20 1044
21 2296
22 811
23 4297
24 4747
25 3601
26 4352
27 638
28 2005
31 2075
31 2948
32 4782
33 643
33 1122
33 4382
34 2565
35 3502
36 3619
38 4411
40 4088
41 2737
42 4068
43 1...

input:

6
5000 2504
1 2412
2 4468
3 1931
4 4100
7 2970
8 1804
9 4078
12 2564
12 4723
13 164
15 4440
16 4212
17 2473
18 4541
19 228
20 1044
21 2296
22 811
23 4297
24 4747
25 3601
26 4352
27 638
28 2005
31 2075
31 2948
32 4782
33 643
33 1122
33 4382
34 2565
35 3502
36 3619
38 4411
40 4088
41 2737
42 4068
43 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32764kb

input:

5
9424319

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2523
1 1909
2 4468
3 1931
4 4100
5 2923
8 3070
9 4078
11 2683
12 2564
12 3407
12 3473
12 4723
13 164
14 969
15 4440
16 4212
17 3966
19 228
21 2296
22 811
23 899
23 4340
25 2768
25 3317
26 4352
28 1558
29 1024
31 374
32 4782
33 643
33 1122
33 4382
34 2565
35 625
36 3619
40 4131
41 2737
43 1561...

input:

6
5000 2523
1 1909
2 4468
3 1931
4 4100
5 2923
8 3070
9 4078
11 2683
12 2564
12 3407
12 3473
12 4723
13 164
14 969
15 4440
16 4212
17 3966
19 228
21 2296
22 811
23 899
23 4340
25 2768
25 3317
26 4352
28 1558
29 1024
31 374
32 4782
33 643
33 1122
33 4382
34 2565
35 625
36 3619
40 4131
41 2737
43 1561...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 5ms = 1ms + 4ms
memory: 1952kb,32796kb

input:

5
10955780

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2529
1 416
2 489
3 1931
4 4100
12 2564
12 3407
12 4723
13 164
14 969
15 4440
16 4212
17 3966
18 3787
19 228
21 2296
22 811
23 899
23 1847
23 4340
24 4747
25 2768
25 3317
28 3524
32 4782
33 643
33 1122
33 4382
34 2565
35 3502
36 3619
40 185
41 172
41 3589
43 1561
44 3815
45 2030
46 1817
47 355...

input:

6
5000 2529
1 416
2 489
3 1931
4 4100
12 2564
12 3407
12 4723
13 164
14 969
15 4440
16 4212
17 3966
18 3787
19 228
21 2296
22 811
23 899
23 1847
23 4340
24 4747
25 2768
25 3317
28 3524
32 4782
33 643
33 1122
33 4382
34 2565
35 3502
36 3619
40 185
41 172
41 3589
43 1561
44 3815
45 2030
46 1817
47 355...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32868kb

input:

7
19938721

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
7 1537
7 2970
8 1804
9 4078
10 3630
11 2918
13 164
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
19 228
21 2296
23 899
23 4297
24 4747
25 3317
26 1147
26 4352
27 638
28 1558
28 3524
30 4424
31 374
31 2948
32 4782
35 3502
36 3619
37...

input:

8
5000 2500
1 1909
1 2412
2 489
2 4468
3 1931
4 4100
5 2208
7 1537
7 2970
8 1804
9 4078
10 3630
11 2918
13 164
15 1419
15 4440
16 3627
16 3694
17 244
17 3966
18 3787
19 228
21 2296
23 899
23 4297
24 4747
25 3317
26 1147
26 4352
27 638
28 1558
28 3524
30 4424
31 374
31 2948
32 4782
35 3502
36 3619
37...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32876kb

input:

7
5129508

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 1909
2 489
2 4468
3 1931
4 4100
5 2923
7 1537
8 3070
9 4078
10 3630
13 164
13 1138
14 969
15 1419
15 4440
16 3627
16 3694
17 651
17 3966
18 4541
20 1044
21 2296
23 899
23 4340
24 4747
25 3317
26 1147
27 638
28 2005
28 3524
30 4424
31 374
32 4782
33 643
35 3502
36 3619
37 2141
38 4411
3...

input:

8
5000 2500
1 1909
2 489
2 4468
3 1931
4 4100
5 2923
7 1537
8 3070
9 4078
10 3630
13 164
13 1138
14 969
15 1419
15 4440
16 3627
16 3694
17 651
17 3966
18 4541
20 1044
21 2296
23 899
23 4340
24 4747
25 3317
26 1147
27 638
28 2005
28 3524
30 4424
31 374
32 4782
33 643
35 3502
36 3619
37 2141
38 4411
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 5ms = 1ms + 4ms
memory: 1956kb,32900kb

input:

7
15332941

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
8 3070
9 4078
10 3630
13 164
13 1138
14 969
15 4440
17 651
17 3966
18 4541
19 3305
20 1044
21 2296
23 4340
25 3317
26 1147
27 638
28 3524
30 4424
31 374
32 4782
33 643
35 3502
36 3619
37 2141
38 4411
39 4382
40 185
41 1...

input:

8
5000 2500
1 1909
1 2412
2 489
3 1931
4 4100
5 2208
6 1118
7 1537
7 3550
8 1804
8 3070
9 4078
10 3630
13 164
13 1138
14 969
15 4440
17 651
17 3966
18 4541
19 3305
20 1044
21 2296
23 4340
25 3317
26 1147
27 638
28 3524
30 4424
31 374
32 4782
33 643
35 3502
36 3619
37 2141
38 4411
39 4382
40 185
41 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

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

input:

1
355365355024496523

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 416
1 1909
2 489
3 4220
4 4100
5 2923
6 1118
7 1537
7 2970
8 1804
9 4078
10 877
11 2918
12 2564
12 3407
12 3473
12 4723
12 4780
12 4954
13 499
14 969
15 1419
15 2926
16 3694
17 244
18 3787
18 4541
19 1628
19 3305
20 1044
20 4036
21 1846
22 811
23 4088
23 4297
24 4747
25 3601
26 4352
27...

input:

2
5000 4527
1 416
1 1909
2 489
3 4220
4 4100
5 2923
6 1118
7 1537
7 2970
8 1804
9 4078
10 877
11 2918
12 2564
12 3407
12 3473
12 4723
12 4780
12 4954
13 499
14 969
15 1419
15 2926
16 3694
17 244
18 3787
18 4541
19 1628
19 3305
20 1044
20 4036
21 1846
22 811
23 4088
23 4297
24 4747
25 3601
26 4352
27...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32956kb

input:

1
727827999106414164

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 4527
1 416
1 1909
1 4674
2 489
3 4220
4 2062
4 4100
5 2208
6 1842
7 415
7 2970
7 3550
8 865
9 4078
10 3630
11 2918
12 2361
12 2564
12 4780
13 164
13 499
13 2722
14 1034
15 1419
15 4440
16 3627
17 651
17 2473
17 3966
18 3787
18 4541
19 228
20 1044
20 3255
21 2296
22 811
22 2992
23 1847
23 2994...

input:

2
5000 4527
1 416
1 1909
1 4674
2 489
3 4220
4 2062
4 4100
5 2208
6 1842
7 415
7 2970
7 3550
8 865
9 4078
10 3630
11 2918
12 2361
12 2564
12 4780
13 164
13 499
13 2722
14 1034
15 1419
15 4440
16 3627
17 651
17 2473
17 3966
18 3787
18 4541
19 228
20 1044
20 3255
21 2296
22 811
22 2992
23 1847
23 2994...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 4ms = 1ms + 3ms
memory: 1952kb,32868kb

input:

1
656410143989222955

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 3669
1 1909
1 2412
2 489
3 4220
4 2062
6 1118
7 1537
7 3550
8 865
8 3070
9 4078
12 2564
12 3473
12 4723
12 4780
13 1138
13 2722
14 969
15 4440
16 3627
16 3694
16 4627
18 4541
19 228
20 3255
21 2296
22 2992
23 899
23 1847
23 2994
23 4088
25 3317
25 4041
25 4145
26 1147
27 638
28 3524
29 3753
3...

input:

2
5000 3669
1 1909
1 2412
2 489
3 4220
4 2062
6 1118
7 1537
7 3550
8 865
8 3070
9 4078
12 2564
12 3473
12 4723
12 4780
13 1138
13 2722
14 969
15 4440
16 3627
16 3694
16 4627
18 4541
19 228
20 3255
21 2296
22 2992
23 899
23 1847
23 2994
23 4088
25 3317
25 4041
25 4145
26 1147
27 638
28 3524
29 3753
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32864kb

input:

1
410366615149657534

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 3669
1 2412
2 489
3 1931
6 970
6 1118
7 1537
8 1804
9 4078
12 2361
12 4780
12 4954
13 164
13 499
13 2722
14 1034
15 2926
16 3694
16 4212
18 4541
19 228
20 4036
21 1846
22 2992
23 899
23 3535
23 4297
25 1442
25 3601
26 1147
26 4352
27 1036
28 3524
29 1024
30 2267
31 374
31 2075
31 2948
32 3062...

input:

2
5000 3669
1 2412
2 489
3 1931
6 970
6 1118
7 1537
8 1804
9 4078
12 2361
12 4780
12 4954
13 164
13 499
13 2722
14 1034
15 2926
16 3694
16 4212
18 4541
19 228
20 4036
21 1846
22 2992
23 899
23 3535
23 4297
25 1442
25 3601
26 1147
26 4352
27 1036
28 3524
29 1024
30 2267
31 374
31 2075
31 2948
32 3062...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32868kb

input:

1
298090682780948428

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

2
5000 3669
1 416
1 1909
3 4220
4 2062
6 1118
7 1537
7 3550
8 865
9 4078
12 2361
12 2564
12 3407
12 4723
12 4780
12 4954
13 164
13 499
14 1034
15 1419
15 2926
16 3627
16 4212
18 4541
19 1628
20 1044
20 4036
21 1846
23 899
23 2994
23 4340
25 3269
25 3601
25 4041
26 429
26 4352
27 638
29 1024
30 4424
...

input:

2
5000 3669
1 416
1 1909
3 4220
4 2062
6 1118
7 1537
7 3550
8 865
9 4078
12 2361
12 2564
12 3407
12 4723
12 4780
12 4954
13 164
13 499
14 1034
15 1419
15 2926
16 3627
16 4212
18 4541
19 1628
20 1044
20 4036
21 1846
23 899
23 2994
23 4340
25 3269
25 3601
25 4041
26 429
26 4352
27 638
29 1024
30 4424
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32876kb

input:

3
969441916331132577

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 416
1 4674
2 4468
3 1931
4 4100
5 2208
7 1537
7 3550
8 1804
9 4078
10 3630
13 499
13 2722
14 1034
16 3627
16 3694
18 4541
19 228
19 3305
20 1044
20 4036
21 1846
22 2167
22 2992
24 4747
26 429
26 4352
27 638
28 2005
29 1024
30 4424
31 2948
32 4782
33 533
33 1122
36 3619
38 2928
39 4094
...

input:

4
5000 2500
1 416
1 4674
2 4468
3 1931
4 4100
5 2208
7 1537
7 3550
8 1804
9 4078
10 3630
13 499
13 2722
14 1034
16 3627
16 3694
18 4541
19 228
19 3305
20 1044
20 4036
21 1846
22 2167
22 2992
24 4747
26 429
26 4352
27 638
28 2005
29 1024
30 4424
31 2948
32 4782
33 533
33 1122
36 3619
38 2928
39 4094
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32860kb

input:

3
929489812741933634

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 416
2 4468
3 1931
5 2208
6 970
7 1537
7 2970
7 3550
8 1804
8 3070
9 641
11 2918
13 1138
14 1034
15 4440
17 244
17 651
18 3787
19 3305
20 2538
21 1846
26 429
27 638
28 1558
30 4424
34 1409
38 2928
39 4094
41 172
41 2236
43 1561
43 2027
43 4703
44 2250
44 3815
46 1869
47 3558
48 2675
49 ...

input:

4
5000 2500
1 416
2 4468
3 1931
5 2208
6 970
7 1537
7 2970
7 3550
8 1804
8 3070
9 641
11 2918
13 1138
14 1034
15 4440
17 244
17 651
18 3787
19 3305
20 2538
21 1846
26 429
27 638
28 1558
30 4424
34 1409
38 2928
39 4094
41 172
41 2236
43 1561
43 2027
43 4703
44 2250
44 3815
46 1869
47 3558
48 2675
49 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1956kb,32864kb

input:

3
144032041325838295

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 2412
1 4674
2 4468
3 1931
4 531
5 2208
7 1537
8 1804
9 4078
13 164
13 499
13 2722
14 969
15 1419
17 2089
17 2473
18 3787
19 3305
20 2538
20 4036
21 2296
22 2992
23 899
23 4297
26 429
26 4352
27 638
28 1558
29 1024
30 2267
31 2075
31 2948
32 4782
33 533
33 4382
38 2928
39 4382
40 4131
4...

input:

4
5000 2500
1 2412
1 4674
2 4468
3 1931
4 531
5 2208
7 1537
8 1804
9 4078
13 164
13 499
13 2722
14 969
15 1419
17 2089
17 2473
18 3787
19 3305
20 2538
20 4036
21 2296
22 2992
23 899
23 4297
26 429
26 4352
27 638
28 1558
29 1024
30 2267
31 2075
31 2948
32 4782
33 533
33 4382
38 2928
39 4382
40 4131
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32836kb

input:

3
832110946250826180

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 416
1 1909
2 489
3 1931
4 531
5 2923
6 970
7 415
7 2970
8 1804
9 641
10 3630
11 2918
13 499
14 1034
18 4541
19 228
19 3305
20 1044
20 4036
21 2296
24 4747
25 268
25 4041
26 1147
26 4352
28 2005
28 3524
30 4424
31 374
31 2948
32 3062
33 643
33 1122
35 3097
36 3619
37 2141
39 4382
40 185...

input:

4
5000 2500
1 416
1 1909
2 489
3 1931
4 531
5 2923
6 970
7 415
7 2970
8 1804
9 641
10 3630
11 2918
13 499
14 1034
18 4541
19 228
19 3305
20 1044
20 4036
21 2296
24 4747
25 268
25 4041
26 1147
26 4352
28 2005
28 3524
30 4424
31 374
31 2948
32 3062
33 643
33 1122
35 3097
36 3619
37 2141
39 4382
40 185...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32840kb

input:

3
85728715707691821

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

4
5000 2500
1 416
1 1909
1 4674
2 489
2 4468
3 4220
4 2062
5 2923
6 1118
7 1537
9 641
13 164
13 499
13 2722
16 3627
16 3694
18 3486
19 228
20 1044
20 2538
20 4036
21 2296
22 2167
22 2992
23 899
23 4340
24 4132
25 268
25 2768
26 1147
27 638
28 2005
28 3524
30 2267
32 4782
33 643
33 1497
33 4382
35 66...

input:

4
5000 2500
1 416
1 1909
1 4674
2 489
2 4468
3 4220
4 2062
5 2923
6 1118
7 1537
9 641
13 164
13 499
13 2722
16 3627
16 3694
18 3486
19 228
20 1044
20 2538
20 4036
21 2296
22 2167
22 2992
23 899
23 4340
24 4132
25 268
25 2768
26 1147
27 638
28 2005
28 3524
30 2267
32 4782
33 643
33 1497
33 4382
35 66...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32768kb

input:

5
777434612360931036

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2503
1 2412
2 3845
3 4220
4 531
5 2923
7 415
8 3070
9 4078
12 2564
12 3407
12 4723
13 1138
16 4627
17 651
18 4541
19 3305
20 1044
22 811
23 4297
25 3317
26 1147
27 638
28 3524
31 2075
31 2948
32 4782
33 533
33 1122
34 2565
35 3502
36 1358
38 4411
40 4131
41 172
41 3589
43 2760
45 2030
46 1817...

input:

6
5000 2503
1 2412
2 3845
3 4220
4 531
5 2923
7 415
8 3070
9 4078
12 2564
12 3407
12 4723
13 1138
16 4627
17 651
18 4541
19 3305
20 1044
22 811
23 4297
25 3317
26 1147
27 638
28 3524
31 2075
31 2948
32 4782
33 533
33 1122
34 2565
35 3502
36 1358
38 4411
40 4131
41 172
41 3589
43 2760
45 2030
46 1817...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32796kb

input:

5
705262511549880222

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2515
1 2412
2 489
3 4220
7 2970
8 1804
10 877
12 2361
12 2564
12 4723
13 164
15 4440
16 4627
17 651
17 2089
17 3966
18 3787
19 228
20 1044
20 2538
22 2167
23 899
23 4340
24 4132
25 2768
25 3317
25 4041
26 4352
28 2005
29 2071
31 2075
31 2948
32 4782
33 4382
34 155
34 417
34 932
34 3068
34 443...

input:

6
5000 2515
1 2412
2 489
3 4220
7 2970
8 1804
10 877
12 2361
12 2564
12 4723
13 164
15 4440
16 4627
17 651
17 2089
17 3966
18 3787
19 228
20 1044
20 2538
22 2167
23 899
23 4340
24 4132
25 2768
25 3317
25 4041
26 4352
28 2005
29 2071
31 2075
31 2948
32 4782
33 4382
34 155
34 417
34 932
34 3068
34 443...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32812kb

input:

5
510318082834167951

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2519
1 2412
2 3845
3 4220
4 531
5 2208
6 970
7 415
8 865
9 641
11 2683
12 2361
12 2564
12 3407
12 3473
12 4723
12 4954
13 1138
14 1034
16 4212
17 2473
18 4541
21 1846
22 2167
23 2994
24 4747
25 3601
26 1147
28 1558
29 1024
31 2948
32 3062
33 533
33 643
33 1122
34 155
34 398
34 932
34 1409
34 ...

input:

6
5000 2519
1 2412
2 3845
3 4220
4 531
5 2208
6 970
7 415
8 865
9 641
11 2683
12 2361
12 2564
12 3407
12 3473
12 4723
12 4954
13 1138
14 1034
16 4212
17 2473
18 4541
21 1846
22 2167
23 2994
24 4747
25 3601
26 1147
28 1558
29 1024
31 2948
32 3062
33 533
33 643
33 1122
34 155
34 398
34 932
34 1409
34 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32788kb

input:

5
914858813253258744

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2515
1 2412
2 489
4 2062
6 970
7 1537
12 4780
13 499
19 1628
20 3255
21 1846
22 2992
23 2994
25 4145
26 1147
28 3524
29 2071
30 4424
31 2075
31 2948
33 2065
34 398
34 1409
34 3068
34 3867
34 4902
35 664
35 1050
35 4235
36 1358
37 959
39 4382
40 185
42 4068
43 2027
43 4703
44 2250
45 811
45 15...

input:

6
5000 2515
1 2412
2 489
4 2062
6 970
7 1537
12 4780
13 499
19 1628
20 3255
21 1846
22 2992
23 2994
25 4145
26 1147
28 3524
29 2071
30 4424
31 2075
31 2948
33 2065
34 398
34 1409
34 3068
34 3867
34 4902
35 664
35 1050
35 4235
36 1358
37 959
39 4382
40 185
42 4068
43 2027
43 4703
44 2250
45 811
45 15...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32780kb

input:

5
659635316746638238

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

6
5000 2505
2 4468
4 4100
5 2923
6 1118
7 2970
8 1804
9 641
10 877
11 2918
12 2361
15 1419
16 4212
17 651
17 2089
19 1628
20 1044
20 2538
21 2296
22 2167
23 4297
24 4132
25 268
25 1442
25 3269
26 4352
27 1036
29 3753
31 2573
32 3062
33 533
33 643
34 155
34 398
34 932
34 1409
34 4902
35 664
35 3097
3...

input:

6
5000 2505
2 4468
4 4100
5 2923
6 1118
7 2970
8 1804
9 641
10 877
11 2918
12 2361
15 1419
16 4212
17 651
17 2089
19 1628
20 1044
20 2538
21 2296
22 2167
23 4297
24 4132
25 268
25 1442
25 3269
26 4352
27 1036
29 3753
31 2573
32 3062
33 533
33 643
34 155
34 398
34 932
34 1409
34 4902
35 664
35 3097
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32860kb

input:

7
858490260563149759

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 416
2 489
3 1931
4 531
5 2923
6 970
7 415
7 2970
9 641
11 2918
13 164
13 1138
14 1034
16 3694
17 651
17 2089
17 3966
18 3486
19 228
19 3305
20 1044
20 2538
20 4036
21 2296
22 2167
23 3535
26 4352
28 2005
28 3524
29 2071
29 3753
30 2267
31 2075
31 2948
32 3062
35 664
35 3097
35 4235
36 ...

input:

8
5000 2500
1 416
2 489
3 1931
4 531
5 2923
6 970
7 415
7 2970
9 641
11 2918
13 164
13 1138
14 1034
16 3694
17 651
17 2089
17 3966
18 3486
19 228
19 3305
20 1044
20 2538
20 4036
21 2296
22 2167
23 3535
26 4352
28 2005
28 3524
29 2071
29 3753
30 2267
31 2075
31 2948
32 3062
35 664
35 3097
35 4235
36 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32892kb

input:

7
860058643727731209

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 1909
2 489
2 3845
3 4220
4 4100
5 2923
6 970
6 1118
7 415
8 3070
9 641
10 3630
13 1138
14 1034
15 1419
16 3694
17 651
17 2089
18 4541
19 1628
19 3305
20 4036
21 2296
22 2167
24 4747
26 1147
27 638
28 3524
29 1024
29 2071
30 2267
31 2573
32 3062
33 1122
34 4902
35 664
36 1358
37 2141
38...

input:

8
5000 2500
1 1909
2 489
2 3845
3 4220
4 4100
5 2923
6 970
6 1118
7 415
8 3070
9 641
10 3630
13 1138
14 1034
15 1419
16 3694
17 651
17 2089
18 4541
19 1628
19 3305
20 4036
21 2296
22 2167
24 4747
26 1147
27 638
28 3524
29 1024
29 2071
30 2267
31 2573
32 3062
33 1122
34 4902
35 664
36 1358
37 2141
38...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1952kb,32892kb

input:

7
718861404514377808

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 2412
1 4674
2 489
2 4468
3 4220
4 4100
5 2208
6 970
7 3550
8 1804
8 3070
9 641
11 2918
13 164
13 2722
14 1034
15 1419
17 651
17 2089
17 3966
18 4541
19 228
19 3305
20 1044
21 2296
22 2992
24 4747
25 3317
26 1147
28 2005
28 3524
29 2071
30 2267
31 2075
32 3062
33 1122
33 2065
35 664
35 ...

input:

8
5000 2500
1 2412
1 4674
2 489
2 4468
3 4220
4 4100
5 2208
6 970
7 3550
8 1804
8 3070
9 641
11 2918
13 164
13 2722
14 1034
15 1419
17 651
17 2089
17 3966
18 4541
19 228
19 3305
20 1044
21 2296
22 2992
24 4747
25 3317
26 1147
28 2005
28 3524
29 2071
30 2267
31 2075
32 3062
33 1122
33 2065
35 664
35 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32880kb

input:

7
659192688464047828

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 416
2 4468
3 1931
4 531
5 2923
7 1537
8 1804
9 4078
13 499
14 1034
15 1419
16 3627
17 651
17 2089
17 3966
18 4541
19 228
19 3305
20 4036
21 2296
22 2167
24 4747
25 1442
26 429
26 4352
28 1558
29 2071
30 2267
31 2948
32 4782
33 643
33 1122
36 3619
38 2928
39 4382
40 185
40 4088
41 172
4...

input:

8
5000 2500
1 416
2 4468
3 1931
4 531
5 2923
7 1537
8 1804
9 4078
13 499
14 1034
15 1419
16 3627
17 651
17 2089
17 3966
18 4541
19 228
19 3305
20 4036
21 2296
22 2167
24 4747
25 1442
26 429
26 4352
28 1558
29 2071
30 2267
31 2948
32 4782
33 643
33 1122
36 3619
38 2928
39 4382
40 185
40 4088
41 172
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1948kb,32864kb

input:

7
685730986714800201

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
316 4770
973 4770
4910 316
2496 4770
3855 973
2508 3855
4834 316
480 316
3581 316
2266 2496
4567 973
2692 4567
2863 2508
2030 3581
1601 973
977 3581
4512 4770
3696 ...

output:

8
5000 2500
1 2412
2 4468
3 4220
4 4100
5 2923
6 970
6 1118
7 1537
8 1804
9 641
11 2918
13 164
14 1034
15 1419
17 244
17 2089
17 3966
18 3486
19 228
20 1044
20 2538
21 2296
22 2167
23 899
23 1847
23 4340
24 4132
26 429
27 638
28 2005
30 4424
31 374
32 3062
33 643
35 625
35 3502
36 3619
37 2141
38 29...

input:

8
5000 2500
1 2412
2 4468
3 4220
4 4100
5 2923
6 970
6 1118
7 1537
8 1804
9 641
11 2918
13 164
14 1034
15 1419
17 244
17 2089
17 3966
18 3486
19 228
20 1044
20 2538
21 2296
22 2167
23 899
23 1847
23 4340
24 4132
26 429
27 638
28 2005
30 4424
31 374
32 3062
33 643
35 625
35 3502
36 3619
37 2141
38 29...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201