QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#467122#1249. Goldfish and pikes2jczoo8AC ✓844ms37020kbC++143.5kb2024-07-08 14:11:442024-07-08 14:11:45

Judging History

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

  • [2024-07-08 14:11:45]
  • 评测
  • 测评结果:AC
  • 用时:844ms
  • 内存:37020kb
  • [2024-07-08 14:11:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 4e5 + 5 , inf = 1e9;

int n , q , a[N] , mx , vis[N << 2];

struct node {
	int cnt , sum;
}tr[N << 2];

struct Q{
	int opt , a , b;
}o[N / 4 + 4];

struct Node {
	int p , cnt , sum;
};

vector <int> v; 

stack <Node> s; 

void push_up(int p) {
	tr[p].cnt = tr[p << 1].cnt + tr[p << 1 | 1].cnt;
	tr[p].sum = tr[p << 1].sum + tr[p << 1 | 1].sum;
}

void modify(int p , int l , int r , int pos , int det) {
	if(l == r) {
		tr[p].cnt += det;
		tr[p].sum += det * v[l - 1];
		return ;
	}
	int mid = l + r >> 1;
	if(mid >= pos) modify(p << 1 , l , mid , pos , det);
	else modify(p << 1 | 1 , mid + 1 , r , pos , det); 
	push_up(p);
}

int query (int p , int l , int r , int x) {
	if(!tr[p].sum) return 0;
	if(x <= l && l == r) return l;
	int mid = l + r >> 1;
	if(x <= mid) {
		int res = query(p << 1 , l , mid , x);
		if(res) return res;
	}
	return query(p << 1 | 1 , mid + 1 , r , x);
}

int ans = 0;

void calc(int p , int l , int r , int pos , int &tmp) {
	if(tmp <= 0 || !tr[p].sum) return ;
	if(!vis[p]) vis[p] = 1 , s.push((Node){p , tr[p].cnt , tr[p].sum});
	int mid = l + r >> 1;
	if(r <= pos) {
		if(l == r) {
			int x = min((tmp + v[l - 1] - 1) / v[l - 1] , tr[p].cnt);
			tr[p].cnt -= x; tr[p].sum -= x * v[l - 1];
			ans += x; tmp -= x * v[l - 1];
			return ;
		}
		else if(tr[p << 1 | 1].sum <= tmp) {
			if(!vis[p << 1 | 1]) vis[p << 1 | 1] = 1 , s.push((Node) {p << 1 | 1 , tr[p << 1 | 1].cnt , tr[p << 1 | 1].sum});
			ans += tr[p << 1 | 1].cnt; tmp -= tr[p << 1 | 1].sum;
			tr[p << 1 | 1] = {0 , 0};
			calc(p << 1 , l , mid , pos , tmp);
		}
		else calc(p << 1 | 1 , mid + 1 , r , pos , tmp); push_up(p);
		return ;
	} 
	if(pos > mid) calc(p << 1 | 1 , mid + 1 , r , pos , tmp);
	calc(p << 1 , l , mid , pos , tmp);
	push_up(p);
}

void solve(int x , int y) {
	if(x >= y) return cout << 0 << '\n' , void();
	if(x <= v[0]) return cout << -1 << '\n' , void(); ans = 0;
	while(x < y) {
		int pos = lower_bound(v.begin() , v.end() , x) - v.begin() + 1;
		int pos1 = query(1 , 1 , mx , pos); 
		int tmp = min(v[pos1 - 1] + 1 , y) - x;
		int d = tmp; pos --;
		calc(1 , 1 , mx , pos , tmp);
		if(tmp > 0) {
			ans = -1; break;
		} 
		x += d - tmp;
	}
	cout << ans << '\n';
	while(!s.empty()) {
		tr[s.top().p] = {s.top().cnt , s.top().sum};
		vis[s.top().p] = 0; s.pop();
	}
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n; for (int i = 1;i <= n;i ++) cin >> a[i] , v.push_back(a[i]);
	cin >> q; for (int i = 1;i <= q;i ++) {
		cin >> o[i].opt;
		if(o[i].opt == 1) cin >> o[i].a >> o[i].b;
		else cin >> o[i].a , v.push_back(o[i].a);
	} 
	sort(v.begin() , v.end()); v.erase(unique(v.begin() , v.end()) , v.end()); v.push_back(inf * inf / 100);
	for (int i = 1;i <= n;i ++) a[i] = lower_bound(v.begin() , v.end() , a[i]) - v.begin() + 1 , mx = max(mx , a[i]);
	for (int i = 1;i <= q;i ++)
		if(o[i].opt != 1)
			o[i].a = lower_bound(v.begin() , v.end() , o[i].a) - v.begin() + 1;
	mx = v.size(); modify(1 , 1 , mx , mx , 1);
	for (int i = 1;i <= n;i ++) modify(1 , 1 , mx , a[i] , 1);
	for (int i = 1;i <= q;i ++) {
		if(o[i].opt == 1) solve(o[i].a , o[i].b);
		else modify(1 , 1 , mx , o[i].a , o[i].opt == 2 ? 1 : -1);
	}
	return 0;
}
/*
32
2 24547 5660 80752 6 1 304 738 1 18010 88 67 1 1 12654 1 1021 1 15 1 3 76 5 1 26582 722 50 2 4 4114 992 1
13
2 25
2 1
3 1
3 26582
2 61
3 1
2 124
2 48
3 304
2 13
2 166
2 1
1 85 6484
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 7688kb

input:

4
1 4 8 1
15
1 2 3
1 2 4
1 2 5
1 3 3
1 3 5
1 3 16
1 4 16
1 8 17
1 100 101
1 100 115
1 3 9
2 2
1 3 9
3 4
1 3 9

output:

1
2
-1
0
2
4
3
2
1
-1
3
2
-1

result:

ok 13 numbers

Test #2:

score: 0
Accepted
time: 1ms
memory: 7688kb

input:

1
5
1
1 1 1

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 1ms
memory: 7580kb

input:

2
19 1
2
3 19
1 2 5

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 7864kb

input:

4
320 9 1 1
4
3 1
1 8 162
3 9
1 8 132

output:

-1
-1

result:

ok 2 number(s): "-1 -1"

Test #5:

score: 0
Accepted
time: 0ms
memory: 7632kb

input:

8
370 2 1 858 8 16 1731 4
8
1 1 453
2 32
1 1 1
2 1
1 18 242
1 34 96
3 370
1 40 797

output:

-1
0
-1
5
-1

result:

ok 5 number(s): "-1 0 -1 5 -1"

Test #6:

score: 0
Accepted
time: 1ms
memory: 7628kb

input:

16
2911 6 27 196 229 2 7 2 16 106 8178 120 1535 5 98 20480
16
1 395 17664
1 43 64
3 229
1 54 808
1 1 507
3 120
1 1 1891
3 16
2 2
3 6
2 3
1 4 12
2 14
1 3 6
1 48 197
1 9 14

output:

-1
1
-1
-1
-1
2
2
5
1

result:

ok 9 numbers

Test #7:

score: 0
Accepted
time: 1ms
memory: 7644kb

input:

32
2 24547 5660 80752 6 1 304 738 1 18010 88 67 1 1 12654 1 1021 1 15 1 3 76 5 1 26582 722 50 2 4 4114 992 1
32
1 1 48929
2 25
2 1
3 1
3 26582
2 61
3 1
2 124
1 5 454
1 77090 175058
2 48
1 3290 163840
3 304
2 13
2 166
2 1
1 85 6484
1 1 125664
1 2 243
2 6941
2 2
2 80
3 12654
3 4
3 124
3 76
2 17036
3 5...

output:

-1
9
2
-1
13
-1
9
-1
5
-1

result:

ok 10 numbers

Test #8:

score: 0
Accepted
time: 1ms
memory: 7632kb

input:

64
371606 214159 1 8567 3906 2475 1 817 6 3 3 37525 928569 3 3 6379 54193 2 1942 34 21 1089 1310720 1310720 5098 29369 8 100 15 1310720 3413 163 91084 751 17 3 6912 1310720 64 241302 1014 5 1 176 1673 1067 115950 428 2 12901 1218 5 473 16 3 582 5 543 225 11594 309859 15673 1093 347
64
1 1 49463
3 10...

output:

-1
-1
18
3
1
-1
8
1
15
0
5
14
2
7
6
7
-1
16
14
1
16
6
16
17
15
8
4
10
-1
10
-1
2
11
9
8
12
15
10
18
-1
-1
7
3
4
10
8
-1
-1
9
14
-1

result:

ok 51 numbers

Test #9:

score: 0
Accepted
time: 0ms
memory: 7632kb

input:

128
64914 3 5603 1093298 109 6 1 1 1904 109455 25 185 2091484 3525 1 1187 6 3 65328 2 10 268 324 1288799 3054206 1 210 52 32250 2 320699 27 559 15 1680263 1 62349 116 729 6325758 210 243428 38 492877 54332 66050 55098 28 4 10 14713 1 1 125 1 1 1 593 51374 3 1 1145 694 9912 3 4043 206 102750 1 26 137...

output:

12
5
2
10
8
8
9
13
0
19
9
8
10
1
6
2
2
-1
2
-1
11
-1
17
0
-1
4
4
5
9
10
13
8
14
0
12
22
23
7
2
7
14
2
-1
5
0
22
8
10
-1
22
10
8
4
1
14
4
11
3
6
17
7
20
19
3
1
-1
6
10
-1
9
11
2
19
13
19
3
12
-1
0
2
13
3
5
16
11
6
7
14

result:

ok 88 numbers

Test #10:

score: 0
Accepted
time: 1ms
memory: 7668kb

input:

200
1 29 1855 1429281 97 2060665 1 71146 712 15 56 3 12 1563595 10000000 1346489 1787819 2 53 40 270 12 239872 346 356902 55 1 167133 6035 5 11 743 66284 824031 6611 6 10000000 1 85927 45 15 4145344 391 113223 26 86 15 987499 248863 516 13646 9 243 327110 84089 2 1605 6902 48 52 137116 45 7 7 15 12 ...

output:

5
6
10
-1
6
4
5
1
21
4
14
22
0
5
-1
4
10
-1
-1
6
12
7
23
5
3
9
-1
12
21
8
4
16
12
3
8
8
11
7
15
10
9
-1
-1
1
1
20
11
4
3
14
5
14
14
2
13
18
-1
22
-1
1
15
2
1
13
20
-1
10
8
6
9
4
12
14
5
10
21
2
9
12
-1
10
3
1
9
5
11
15
8
5
9
9
12
6
4
6
11
5
8
23
15
5
11
-1
12
-1
9
11
15
6
13
15
3
6
4
1
9
6
-1
1
-1
5...

result:

ok 137 numbers

Test #11:

score: 0
Accepted
time: 1ms
memory: 7736kb

input:

200
77203 21345 3506 1305 29120 6951215 32 1815078 296 8 63 118 480495 1732 118412 521 8260920 3 67077 30979 38 7 1482622 53 1421 1 165639 13 4271721 7070 1 33 5 900 5 5531 83 26 112 6704 1 1004 236672 72 244 73 19461 5021117 8 339 870830 2 36900 445 1 222508 5925293 1 1478 1 10262 6304950 220 23182...

output:

-1
10
4
7
7
6
3
6
-1
7
16
-1
11
7
5
4
4
-1
-1
-1
22
16
11
-1
9
1
4
1
1
-1
2
1
16
13
16
20
1
3
16
21
9
7
7
14
16
2
16
0
5
-1
7
12
-1
3
-1
10
3
6
3
7
7
4
-1
5
12
3
6
-1
14
-1
28
17
6
11
18
14
9
-1
7
-1
-1
3
-1
15
2
6
4
4
16
2
2
2
20
8
15
-1
4
11
-1
-1
-1
15
2
8
8
5
13
12
21
21
-1
-1
-1
2
5
5
3
9
-1
7
...

result:

ok 126 numbers

Test #12:

score: 0
Accepted
time: 1ms
memory: 7868kb

input:

200
28 7 2965699 4 1 1 2154974 8344 7661 2 4 54 1561876 10000000 3059581 1 2001 111 24184 1 1061285 1096166 195 22449 31602 2 60111 4 510 132 381309 1966778 1 467422 1864 7 1 8612 1 595 1 14 2 1647399 4 12 1942502 488493 10000000 40598 56533 5 6876 144469 7621480 1 5 10000000 1006 1 61 2 1536 72 754...

output:

14
-1
10
6
5
-1
1
16
-1
1
-1
10
1
10
-1
1
-1
15
13
14
8
22
3
12
6
3
14
6
15
17
4
5
17
14
1
9
1
15
9
15
7
19
11
-1
22
6
9
19
4
8
12
10
-1
-1
14
1
1
2
4
-1
3
4
10
-1
12
14
-1
1
12
3
0
9
4
6
-1
-1
6
1
10
4
-1
1
8
4
-1
4
9
-1
8
14
3
25
1
-1
8
15
14
18
5
10
3
22
2
21
6
7
5
11
2
4
22
18
15
13
2
-1
2
11
2
...

result:

ok 135 numbers

Test #13:

score: 0
Accepted
time: 1ms
memory: 7944kb

input:

200
1768 409 27150 2631294 2 42771 1 147 7162214 15 1028050 1586 30 2 206736 42071 339203 32 361822 20 32147 19 4893 3 34934 115363 1606 4 6 1 40 58237 2 24180 18266 7 228978 1755 32270 6816 1 341 4059682 29649 60 8 3360 2734 229458 14019 225995 43 773 1 993 171711 2 746 2 766 2 107686 162957 192346...

output:

7
21
8
9
-1
9
-1
17
21
15
6
12
15
5
13
5
13
1
-1
-1
2
9
6
1
10
17
9
-1
4
1
23
10
12
1
3
13
17
5
8
-1
9
20
13
2
17
-1
8
-1
17
5
3
21
3
17
-1
4
-1
4
6
10
3
24
21
27
2
13
9
2
7
19
17
6
7
18
11
3
9
9
2
8
7
2
22
-1
-1
16
-1
18
3
10
1
2
7
10
-1
6
13
4
3
-1
-1
-1
13
1
14
17
4
4
4
19
2
7
8
10
11
1
5
16
5
17...

result:

ok 137 numbers

Test #14:

score: 0
Accepted
time: 0ms
memory: 7932kb

input:

200
3287131 1 6 258 633 2 17 3819416 1 19378 1 806605 15 98837 730227 1 1466254 9 19704 12066 2 589039 7793382 5246 559577 71844 1 2977 8551 823416 5 282689 10000000 36863 53834 228 1 1 4881 279497 7 10000000 21 10000000 3 467659 467490 12940 396718 1 88588 103617 29531 109998 1268 2762407 3419 4 40...

output:

13
1
6
15
4
5
-1
5
8
5
8
3
11
7
20
-1
-1
12
8
-1
4
12
3
12
6
-1
14
25
-1
12
5
2
0
1
4
22
-1
10
8
18
5
14
1
7
7
15
15
-1
17
8
11
4
8
-1
3
2
1
2
7
14
5
13
2
15
5
10
1
10
1
7
10
-1
-1
1
6
7
20
21
9
19
15
20
22
7
14
1
-1
13
-1
5
8
-1
12
13
-1
13
20
4
12
0
2
7
8
8
6
4
-1
2
6
10
7
15
3
11
-1
6
-1
16
11
3
...

result:

ok 133 numbers

Test #15:

score: 0
Accepted
time: 1ms
memory: 7852kb

input:

1
1
7
1 1 2
1 2 2
1 2 3
3 1
1 1 2
1 2 2
1 2 3

output:

-1
0
1
-1
0
-1

result:

ok 6 numbers

Test #16:

score: 0
Accepted
time: 0ms
memory: 7636kb

input:

1
99999999
15
1 99999999 150000000
1 100000000 150000000
1 100000001 150000000
1 99999999 100000000
1 100000000 100000000
1 100000001 100000000
1 99999999 200000000
1 100000000 200000000
1 100000001 200000000
1 99999999 200000001
1 100000000 200000001
1 100000001 200000001
1 99999999 199999999
1 100...

output:

-1
1
1
-1
0
0
-1
-1
1
-1
-1
-1
-1
1
1

result:

ok 15 numbers

Test #17:

score: 0
Accepted
time: 32ms
memory: 15800kb

input:

100000
15062855193 14719 14 1 327 100 1070096655 18 1 632041 462 106 2693457 24632 1080910587 14522275 14 382395271 47948775822 43625 188359 763 5613813 45002347576 29290530 367712996 490825990 125323388 65442397900 796 100677461971 1534 250 341074 56 6 531746 93031 27 61012 24629 54 1426585 2354617...

output:

2
24
16
8
11
3
19
19
7
-1
-1
7
3
1
2
34
25
9
27
-1
6
9
11
22
16
7
25
2
2
10
31
-1
9
5
6
35
10
13
81
31
11
31
54
22
14
32
24
20
9
9
3026
15
13
1
-1
23
10
4
1
19
6
11
23
19
68
3
-1
12
12
12
38
22
4
7
-1
-1
15
8
30
3
-1
5
3
9
27
7
36
24
-1
10
-1
8
-1
12
4
10
17
11
12
14
5
15
35
7
166
5
13
13
9
5
9
5
8
...

result:

ok 157 numbers

Test #18:

score: 0
Accepted
time: 36ms
memory: 16052kb

input:

100000
413479896 133386826 205 193 3680886 1806409 4095 58490122 12122477 1307 61451454866 12 14914299 3321634838 5136271 247 41719098 32 2555093 9789170 1 26860298 13 28727680 2539 100069664634 134937960 109 45526139 73049 212388234066 28033 849712774 128320 1 136754811010 1 18 38 35700296 228 5758...

output:

7
5
294
9
26
19
3
32
17
17
7
3
10
176
13
5
5
20
-1
19
7
2
8
16
-1
20
31
4
291
6
16
5
5
21
6
-1
12
29
20
4
641
7
10
16
7
12
7
14
-1
8
40
6
7
6
6
1
37
20
-1
3
1
3
11
12
5
9
11
26
4
728
14
8
3
-1
-1
5
19
4
-1
4
3
31
14
18
22
4
1
17
9
457
9
6
20
440
24
5
17
36
21
13
2
551
21
1
-1
31
12
1
40
24
3
-1
17
1...

result:

ok 326 numbers

Test #19:

score: 0
Accepted
time: 17ms
memory: 12496kb

input:

99951
1890 1890 1890 619536803214 1890 1890 619638020137 619550417158 1890 619614685943 1890 619554116292 1890 1890 1890 619577601959 1890 1890 1890 619591171726 619628192322 1290760515 1890 1890 1890 1890 619561937981 1890 619589436811 619580224038 619607837833 1890 619556125271 619596836414 619548...

output:

258
4
3
48846
49040
3
0
9
2
0
49038
-1
14139
0
1
0
-1
6
-1
10
4
-1
-1
4
-1
3
-1
2
3
-1
2
-1
-1
-1
-1
4
10
24393
5433
6
0
-1
-1
-1
0
1
2
8
-1
3
3
48790
-1
-1
24396
9
3
9
-1
-1
-1
-1
2
-1
-1
-1
-1
24396
24396
-1
5
-1
-1
-1
30
-1
242
121
24393
166
210
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
0
-1
6
0
4
18
49...

result:

ok 342 numbers

Test #20:

score: 0
Accepted
time: 18ms
memory: 10408kb

input:

99918
19 19 19 19 19 19 19 19 65820365945 65831064233 65821595407 19 19 19 19 19 19 19 19 65825629200 19 19 19 19 65819536596 65818382435 19 19 19 19 19 65818988700 19 19 19 19 19 65823874743 65823843616 19 19 65824156538 19 19 65820884398 19 65820339612 19 65823614581 65820262356 19 65821881996 19 ...

output:

0
9
-1
1
-1
-1
-1
-1
-1
-1
-1
-1
0
0
-1
-1
0
-1
-1
8
0
-1
-1
-1
62866
1
-1
-1
-1
-1
-1
-1
11
-1
27086
3
-1
-1
-1
3
-1
2
-1
0
1
1
2881
-1
53174
-1
-1
-1
0
-1
4
-1
-1
27503
-1
-1
-1
-1
-1
-1
-1
0
-1
-1
-1
-1
31433
-1
-1
-1
35320
0
-1
-1
-1
0
1
2
-1
-1
62866
-1
-1
62863
-1
60250
-1
-1
62866
-1
1
59988
...

result:

ok 316 numbers

Test #21:

score: 0
Accepted
time: 21ms
memory: 10280kb

input:

100000
20246511309 20249287475 20246804415 2117 2117 2117 2117 2117 20246625808 20248631311 20249237335 2117 20246317689 20249282327 20246543049 2117 20247357709 20248553239 2117 20246727372 2117 20248092146 20247628138 20247444862 2117 2117 20247931006 20247006527 2117 20248950445 20249020505 20246...

output:

2
18
4
1
0
52327
52345
4
52322
52329
1
52314
14
26202
52327
-1
52320
5
52280
6
26191
52331
52315
52315
52323
7
52306
52266
72
52288
52318
93
5415
52322
52376
52
52321
0
52324
6
52385
-1
52328
26
56
52361
19754
52279
52379
0
2
52283
8860
6950
40
4
52317
34
52299
27
52280
52316
26135
52317
52304
6
22
...

result:

ok 330 numbers

Test #22:

score: 0
Accepted
time: 39ms
memory: 12500kb

input:

99917
549787079960 549753500592 549796405831 549784411109 549779186501 549744229451 549736216875 549795884982 549741799715 549733308764 549750468542 549726968838 549718933628 549788496933 549797114413 549798546667 549724970380 549736320165 549804752382 549753484242 549771620102 549704589223 54979894...

output:

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

result:

ok 340 numbers

Test #23:

score: 0
Accepted
time: 34ms
memory: 12332kb

input:

99906
9794075214 9795040798 9794984324 9793760457 9794726592 9793890013 9793728419 9794707455 9794772064 9794152775 9794709406 9794917552 9794764634 9794746884 9793566066 9794755295 9794021415 9793660362 9794681219 9794822546 9794988899 9794864283 9794756028 9793760778 9793632115 9794655479 97953352...

output:

-1
7
-1
1
12
0
10
-1
22
3
15
-1
0
7
14
22
10
30
0
2
25
30
9
35
-1
23
4
-1
36
-1
13
8
21
28
21
23
0
22
0
5
28
-1
3
2
19
0
-1
0
3
23
6
14
-1
2
35
-1
-1
137
21
31
10
-1
5
34
18
24
0
28
20
-1
-1
0
15
-1
31
-1
17
-1
6
-1
19
24
2
-1
29
32
-1
1
13
-1
36
0
22
5
4
-1
10
17
33
17
-1
15
-1
10
1
0
15
36
-1
-1
1...

result:

ok 330 numbers

Test #24:

score: 0
Accepted
time: 27ms
memory: 12612kb

input:

100000
610 987 701405312 121393 21 55 32954232929 2 4181 225846902559 591293415462 46364 32950843146 63248058 1 144 12585287860 9227890 12585191756 3524734 89 102323971 591234267930 121387 956764172931 144 591313461646 5 121390 9228174 13 610 8 701447619 2178319 701435871 34 2 1 3 1 1 55 121402 1395...

output:

16
40
12
42
20
50
33
41
41
24
18
39
50
15
19
21
47
53
11
23
30
7
22
31
26
16
23
50
16
48
13
36
18
27
20
53
22
51
39
47
49
46
26
33
21
25
11
10
20
35
51
24
15
45
31
30
16
21
23
28
16
39
17
24
14
30
41
19
28
40
31
22
17
42
51
31
50
51
43
50
36
14
19
42
10
42
45
16
14
26
41
45
43
31
52
22
46
12
28
31
4...

result:

ok 341 numbers

Test #25:

score: 0
Accepted
time: 26ms
memory: 10724kb

input:

99956
8 5 5 6129 999968973943 45787440 9749735666 999928206431 2678530381 482882015 9748241990 999928819239 1000000000000 999941590175 1000000000000 999951507203 1712861549 4391511421 6129 1000000000000 149849360 981 1 67 33635594385 1000000000000 736407 185017467005 981 999983275988 22895601 416237...

output:

14
46
13
5
14
14
38
41
25
45
46
15
46
45
24
2
46
44
26
34
46
33
34
30
21
24
25
5
31
39
46
11
14
37
14
33
44
22
16
28
45
10
32
-1
9
43
38
43
44
13
31
15
-1
43
36
46
12
11
33
28
45
14
45
18
43
31
36
43
46
46
36
8
3
40
43
44
44
24
19
38
11
38
31
46
36
20
34
46
18
14
17
33
20
36
28
10
17
17
21
25
29
33
...

result:

ok 327 numbers

Test #26:

score: 0
Accepted
time: 459ms
memory: 18616kb

input:

200000
246107 287 191684687 293478321 3 77896006 101 3951 243551 93854402989 14588 411 1233294 34714195349 6710 150706 505 7 9873 520110791418 139080 26 994810261 2113213079 12648235 4 23748650862 3109 11655 2001562127 14295 320133157 76462488438 1038204 155 89272105 1474959 53571691 3 27429 3590132...

output:

19
25
343
20
6
15
63
1
34
2
24
5
15
7
15
-1
8
7
18
16
3
5
23
16
-1
1
0
-1
-1
1
27
32
969
4
15
3
29
58
50
4
-1
30
3
7
16
9
19
35
3
13
3
22
6
28
25
174
74
20
2
19
15
2
2
14
8
27
6
9
8
3
35
29
2
7
-1
5
8
8
21
9
30
21
12
11
2
14
30
25
14
37
-1
3
24
10
12
5
8
7
14
8
17
7
5
20
64
8
18
16
7
18
11
21
1
10
3...

result:

ok 60000 numbers

Test #27:

score: 0
Accepted
time: 123ms
memory: 14988kb

input:

199912
834771100981 834717008579 48 48 48 48 48 834698356484 834771256124 834681446375 834716193073 48 834736106659 834704085513 48 834752623866 48 48 48 48 834722311172 834709601757 834653335669 834711083439 48 48 48 48 834687944621 48 834710015668 48 834696637495 48 834633486822 834645853289 83465...

output:

110647
110581
2
24184
110589
3
2
110601
110591
3
110587
3
12343
55
2
-1
110649
0
5
110585
-1
110638
-1
0
55323
-1
-1
31119
103319
110590
-1
-1
27558
110638
110604
6
24187
2
110588
6
110616
61
1
2
69
89058
5
-1
2
18105
108991
110621
7
110584
80672
8
-1
-1
-1
2
58
-1
110633
3
-1
110611
1
7
110593
2
11...

result:

ok 60000 numbers

Test #28:

score: 0
Accepted
time: 117ms
memory: 18092kb

input:

200000
322738822459 5792 322779512026 322770579438 5792 5792 322743462773 322756968245 322789829822 322754869342 322755356374 322753746530 5792 322785496136 322779590505 322750029711 5792 322763011837 322753745501 5792 5792 322765366803 322748768464 322766500325 5792 5792 5792 322764952036 322792080...

output:

75450
75448
10
75457
75458
4
75453
48
30
11
75455
8
17
19
5
9
37708
75460
17
48
75409
45148
3
52708
75454
7
29
-1
18
11
75459
10
53162
75429
2
75436
75436
75456
75474
19
75460
49
75476
35
75470
75454
29
0
75458
10
75457
19
75446
2
75458
75449
2
75430
28
75446
36
75429
47
75442
8
75471
75479
34
36
17...

result:

ok 60000 numbers

Test #29:

score: 0
Accepted
time: 86ms
memory: 14852kb

input:

200000
1008 29303434741 1008 29304201586 29302802966 29306207751 29302434422 1008 1008 29305413681 1008 1008 1008 29303761829 1008 29305218369 29301758640 1008 29301007497 29304231557 1008 29301572969 29304217378 1008 29306566581 29301792242 29303530394 1008 1008 29305991835 29304922854 29304366550 ...

output:

5475
8
-1
119234
4
-1
-1
-1
0
0
0
56
119222
119224
119234
2
-1
-1
119308
119314
503
-1
0
3
90
119187
3
10
0
13
0
4
72
119234
44396
119307
-1
4
2
-1
0
119308
119309
119306
9
59633
119234
119236
0
0
45
-1
-1
0
38
119234
31
2
59
0
87
2
5
-1
73174
-1
54
0
-1
-1
119233
91
-1
2
119316
59571
2
119235
11933...

result:

ok 60000 numbers

Test #30:

score: 0
Accepted
time: 262ms
memory: 19196kb

input:

199889
549795176554 549728491866 549788580017 549752859325 549777196565 549743457776 549748141816 549762904272 549707925849 549749534970 549736323833 549725374722 549789547052 549808956481 549720817522 549760652831 549804422612 549746263613 549703017375 549744672088 549800236203 549770699844 5497160...

output:

23
15
30
33
11
12
27
7
11
5
19
3
2
2
2
36
25
2
26
31
39
11
10
21
5
30
15
16
0
0
25
20
38
6
1
6
27
25
3
0
9
16
29
13
39
21
17
4
29
0
29
13
1
24
11
21
4
23
34
21
16
2
2
10
4
30
33
16
5
28
20
33
15
2
2
23
39
10
37
3
3
26
15
0
6
33
40
27
1
27
9
19
30
5
0
0
32
22
30
12
16
39
1
20
34
13
21
13
15
1
17
4
0
...

result:

ok 60000 numbers

Test #31:

score: 0
Accepted
time: 222ms
memory: 18844kb

input:

200000
111211445991 111220112040 111208323394 111207317063 111202033095 111218070333 111208333692 111218548039 111220295424 111203504762 111205505433 111219921481 111205897932 111203964507 111219633026 111208827628 111212836524 111206274066 111223003299 111207153858 111214995062 111212282141 1112178...

output:

0
9
8
-1
34
38
2
10
15
0
-1
22
10
-1
34
-1
-1
10
22
27
21
3
-1
-1
24
12
-1
26
4
23
31
9
0
-1
-1
1
9
7
17
-1
17
33
33
0
34
28
32
5
-1
10
12
2
0
2
3
27
0
16
23
30
3
7
3
-1
3
2
19
13
32
33
30
13
0
18
3
-1
15
12
1
12
32
9
2
0
0
13
28
23
12
-1
0
-1
24
12
-1
-1
-1
-1
-1
30
-1
11
13
8
11
19
21
24
1
15
-1
1...

result:

ok 60000 numbers

Test #32:

score: 0
Accepted
time: 457ms
memory: 15428kb

input:

199841
2178313 21 6765 377 1836166211 1 365448611771 121393 28657 7778705879 46368 1836400191 165577821 10946 21 12585278316 86265940052 165574531 20364237717 1134848134 13 9227141 144 4807347811 1597 28658 63245064 63247648 63241845 225838050760 1346316 956736700505 365421416230 233 6765 8627612171...

output:

15
46
23
12
23
50
44
44
27
19
48
20
38
34
18
32
17
53
21
24
43
13
44
12
22
21
43
16
54
50
6
47
37
15
38
52
26
10
4
40
39
7
43
42
21
43
41
19
37
35
51
41
9
34
22
31
34
48
19
50
16
48
51
10
41
11
9
7
29
50
51
42
21
34
54
34
47
54
48
25
53
45
17
41
48
44
17
46
26
43
41
15
13
27
32
32
44
19
41
42
53
54
...

result:

ok 60000 numbers

Test #33:

score: 0
Accepted
time: 421ms
memory: 18488kb

input:

200000
5721905784 5838 14 1000000000000 1050801 3 999950696385 38918 38000700603 156471920 2919 1000000000000 4 999926776852 14 2919 11444997953 1000000000000 2101557 156462283 19459 14 3 156479802 1029659631 5838 1000000000000 294 7 42 2101871 330848 7024386 154 999943342445 58380 45961989 3152715 ...

output:

36
20
20
43
33
4
46
11
29
11
15
28
16
12
24
18
16
28
22
31
45
46
26
46
23
21
32
20
34
4
24
7
30
22
45
2
2
45
40
11
32
20
46
19
19
30
41
45
33
9
26
31
9
16
31
2
31
21
44
15
24
5
28
27
25
26
17
29
26
43
19
43
3
5
29
33
45
37
33
8
39
46
25
13
41
23
30
10
30
38
39
13
46
34
27
31
27
20
14
33
17
13
36
22
...

result:

ok 60000 numbers

Test #34:

score: 0
Accepted
time: 184ms
memory: 23628kb

input:

199925
12609382 860623654885 12766879 12657886 848491978434 852385012606 860763742564 849839408387 12745555 854994662770 12702100 12601227 851353934124 863958443088 859930040694 851341992802 854186690544 12779160 855816546836 863080019889 12623456 12716704 12609266 850755996575 862303968003 85343918...

output:

6
30
19
66774
7
0
7
29
22
33
12
3
29319
2
37
-1
-1
4
16
20
0
-1
3
15
66792
21
33
1
52
32907
12
18
31
8
5
12
24
66764
2
2
21
57
6
13
20902
0
8
24
66782
28
13
16
17
0
52282
10
7
66764
3
60
18
1
28
17
48568
0
16
26
0
4
13
33
7
13574
17
2
5
1
5
42299
270
1
12
2
57
18
20
66795
43
66246
66768
10
14
19
0
3...

result:

ok 60000 numbers

Test #35:

score: 0
Accepted
time: 844ms
memory: 25928kb

input:

300000
4912700 1 396 61257 337705255 9163051 11478627302 7260 751461762 1 4 7892 21108293 114 43673145 31 210 4236296657 10364469651 3388374259 255630037 1174394819 8960742 99311961 7870 4736502261 2527716 7417002 4892793 119314703 743056 516465 2 32497320427 2383 2502519465 1548790 5679 87510949 90...

output:

23
15
19
2
6
21
7
8
7
1
18
23
16
17
14
18
10
3
20
22
26
23
10
15
-1
15
17
23
6
134
5
27
3
14
1
1045
16
33
1
17
19
4
3
37
13
22
18
-1
2
10
639
21
20
996
11
10
13
17
6
12
8
1
-1
6
6
3
14
7
1
24
83
18
4
5
15
3
6
2
26
4
2
-1
2
1
-1
12
-1
493
13
13
27
2
6
1
26
16
4
37
-1
23
14
27
28
17
2
11
7
27
-1
5
34
...

result:

ok 100000 numbers

Test #36:

score: 0
Accepted
time: 176ms
memory: 23560kb

input:

299777
506675097622 506690046988 506702289841 506737447052 506729159967 3288 506696435684 3288 506740401355 506667869193 3288 506739499559 3288 3288 3288 3288 3288 3288 3288 3288 506657274378 3288 506695887332 3288 3288 506723000187 3288 506699466585 506698599556 506742010726 3288 3288 506660664326 ...

output:

51930
155
-1
3
715
2
0
153012
14
-1
-1
-1
89560
3
76519
7
140
23063
153037
153023
153028
0
-1
-1
153023
61027
7
-1
153036
21
153010
0
-1
149317
152889
-1
139
23
153030
6
76
-1
4
152882
36
77
93775
-1
2
-1
29
2
139
3
0
-1
0
53
153024
73
153033
0
153027
2
-1
0
-1
139
152887
0
2
139
141
-1
153029
15303...

result:

ok 100000 numbers

Test #37:

score: 0
Accepted
time: 151ms
memory: 17264kb

input:

299998
49806640367 49800641208 9 9 9 9 49807505013 9 9 9 9 9 9 9 9 49800447142 9 9 49799024613 49803009012 9 9 49802102000 49800583501 9 9 49801766935 9 49806690714 49799965272 9 49800172256 49805327387 9 49800346491 9 9 9 49804867259 49801912736 9 9 9 49798789135 9 49799629152 49798484253 497979919...

output:

-1
179322
89
-1
-1
0
179318
-1
-1
-1
-1
179308
157213
-1
11
-1
-1
-1
-1
16
179406
179314
97883
-1
-1
179320
7
134937
179313
114971
-1
-1
134940
78902
134930
-1
67530
-1
67475
179318
179405
179318
179315
179455
-1
119675
179406
44369
-1
135019
86
179399
1
-1
2
179399
44379
4
-1
-1
0
157113
179312
-1
...

result:

ok 100000 numbers

Test #38:

score: 0
Accepted
time: 178ms
memory: 24876kb

input:

300000
4236 141538666080 141539080174 4236 141541028568 4236 4236 4236 141534297391 141535207018 141540495993 4236 4236 4236 4236 141543905451 141550365237 4236 141546482724 141529514340 4236 4236 141540558718 141538673836 141538341209 141538362307 141536859086 141527821197 4236 141544335946 1415455...

output:

62
61
139275
118
139224
117
139225
139235
-1
-1
3
39306
118
119
139224
2
139341
139276
59
132048
-1
126688
139217
49346
139217
121
-1
2
62
139223
118
28
139346
139244
5966
3
59
121
120
-1
3
139215
139355
9
1
59
59
139243
47
139285
4
139235
117
120
139333
139244
139222
14
139244
139223
117
3
139341
1...

result:

ok 100000 numbers

Test #39:

score: 0
Accepted
time: 455ms
memory: 32004kb

input:

300000
549745871053 549726378221 549769943433 549772262919 549779986035 549733530513 549705049163 549742303821 549748237011 549784646841 549799503926 549789848781 549724354127 549808831733 549798010007 549769478718 549728034185 549807664363 549703325554 549755030334 549792479413 549737885744 5497158...

output:

40
5
26
2
37
27
12
28
33
8
8
28
12
35
5
24
7
14
29
0
4
19
2
0
23
7
23
22
0
18
23
3
4
31
37
22
2
39
21
25
0
29
33
23
37
4
17
17
14
8
32
0
0
13
18
7
9
0
15
24
22
0
23
3
22
32
28
29
22
34
26
17
21
0
26
26
3
35
3
27
2
7
5
37
5
8
25
2
19
34
4
9
5
12
12
30
14
27
20
15
3
2
6
0
19
8
28
15
3
5
2
18
31
9
2
12...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 352ms
memory: 32464kb

input:

299752
20724790976 20722670597 20721736873 20723761437 20722201769 20721705604 20723701753 20722699910 20722957982 20725637874 20724957839 20723492491 20724736972 20723692658 20725180401 20722418301 20722706952 20725105148 20725698364 20723353467 20723664780 20722347214 20725202997 20725031981 20724...

output:

17
-1
10
17
4
26
12
4
3
2
29
34
-1
1
0
25
24
0
6
-1
1
2
23
0
4
19
2
0
2
10
2
11
-1
2
28
23
36
0
12
0
34
11
9
22
-1
38
-1
0
-1
25
0
16
2
-1
13
33
86
18
-1
-1
13
35
-1
-1
19
18
8
5
9
14
19
2
0
-1
21
3
-1
3
8
0
12
30
-1
30
20
22
2
18
29
22
18
0
30
-1
-1
6
9
27
11
-1
-1
25
29
11
6
3
2
2
13
2
73
-1
-1
31...

result:

ok 100000 numbers

Test #41:

score: 0
Accepted
time: 792ms
memory: 19316kb

input:

299816
86263775124 987 514195 4181 10945 4807667553 32951992302 610 7778623734 610 1346202 2178524 8 8 12587115460 377 3 591248994299 28655 2178127 1597 10946 377 10945 1346141 4181 8 610 21 121382 196435 2 377 121404 86271723108 5 28659 165567400 2971158788 75029 8 46368 32949246158 144 1836391185 ...

output:

30
21
43
18
20
53
7
27
51
32
53
24
40
16
49
49
20
28
29
20
17
21
25
16
36
0
16
35
39
3
50
38
47
36
30
53
52
26
9
54
49
37
28
45
23
20
28
31
35
5
26
49
54
21
50
38
20
15
14
4
51
25
17
25
12
17
37
34
31
19
31
18
15
46
53
19
16
53
22
53
26
23
28
35
44
54
31
36
18
51
32
15
20
48
34
35
50
21
4
28
51
23
4...

result:

ok 100000 numbers

Test #42:

score: 0
Accepted
time: 730ms
memory: 21456kb

input:

299967
15 6049523 7 217756133 22431968570 1008236 638 1000000000000 1524556485 22 999961276464 10033 399623 999980798962 15 33440 5016 5016 154 399630 44 999907873305 608550 6049262 61870 5016 999977926551 10033 72592420 15461923542 61864 608642 1000000000000 2322862872 999985577280 1000000000000 72...

output:

25
38
20
21
45
14
37
42
28
18
31
33
22
45
47
2
30
32
35
46
16
13
20
8
13
41
20
18
43
35
45
14
47
16
38
33
18
8
47
46
16
46
23
8
23
5
16
39
34
34
20
13
39
46
46
32
45
28
19
47
25
31
37
28
27
46
20
17
33
37
46
30
23
15
31
44
25
21
19
16
26
27
26
27
39
17
32
44
46
29
13
18
0
45
41
6
47
31
46
40
47
16
2...

result:

ok 100000 numbers

Test #43:

score: 0
Accepted
time: 294ms
memory: 26068kb

input:

300000
4923680 632427576241 633104073892 4897186 628318878474 628871508038 4939394 4957442 635327710394 4956920 633668158896 637956541354 4980630 637878432070 628694442384 4912837 4912419 626472412872 4946887 633706347182 638232970149 4939562 635123041313 4907708 633505495411 631258502000 6284593140...

output:

5
10
126890
-1
19815
11
126905
39
27
0
126897
19
15
17
3
10
32
17
126925
12
3
438
2
126926
24
17
5
4
13
2
90982
5
0
50
123
5
2851
48617
96933
28
62276
4
5
16
126928
18
92157
14
11
19
15
2
14
20
6
152
126928
0
0
4
4
-1
8
13
17
11
5
36
62767
1
1
4
21
11
-1
47
-1
0
8
-1
11
20
-1
11
22
-1
15
126931
7409...

result:

ok 100000 numbers

Test #44:

score: 0
Accepted
time: 0ms
memory: 7728kb

input:

500
15359 4 5180565 3027981 225027 1453707 2223 24664 142 83 12 61705 1696814 179894 10000000 1307 425483 221801 504452 240 3 4 64 2343 1310500 3340341 5838 13418 62242 19 1917 160 243 69 10 1 126613 1 1 51 173211 2 10000000 1 4041986 5 1969092 378 26 13 6908 2268 2177492 14 5 982 8141 111321 2 3945...

output:

7
3
11
29
6
7
3
-1
1
15
3
7
8
16
10
3
17
-1
6
-1
4
17
14
7
7
-1
21
4
-1
19
5
9
1
7
18
23
7
7
2
6
1
-1
3
5
5
-1
13
10
-1
11
-1
16
13
13
-1
11
3
6
13
2
16
-1
8
-1
12
4
1
0
6
13
13
4
3
5
11
-1
1
5
9
23
2
9
3
3
2
-1
5
-1
2
17
12
-1
4
1
7
8
14
4
7
7
2
0
3
8
5
8
17
14
8
2
5
4
8
7
5
2
4
3
-1
3
17
-1
3
8
1
...

result:

ok 500 numbers

Test #45:

score: 0
Accepted
time: 2ms
memory: 7948kb

input:

500
26689 3 2 93095 2 523170 184833 975 3 1 1 1598823 362060 1467400 1 1264 71 15626 505528 1217879 6 24 11 8108 100104 5 2 55051 229745 10000000 192546 5 3 1 11 1 1 52 902 26759 5 6555308 344368 1 12 12295 59 14 6 887 94 174 9800566 55818 7 1775731 100 5230649 7097 2361 123 17 847591 10 7 66405 1 1...

output:

19
14
19
40
17
5
9
12
-1
3
7
22
6
2
9
18
2
20
4
19
2
4
11
-1
4
7
18
16
1
-1
-1
-1
1
-1
10
-1
12
6
3
2
8
15
9
19
9
2
28
7
12
17
14
15
1
-1
1
-1
-1
11
8
14
3
-1
9
0
16
12
-1
14
3
-1
11
4
17
6
8
1
16
2
8
7
7
22
7
-1
-1
7
20
-1
-1
1
-1
26
8
-1
3
9
11
10
9
9
-1
4
11
7
-1
30
1
8
4
10
12
7
29
5
7
2
1
6
6
5...

result:

ok 500 numbers

Test #46:

score: 0
Accepted
time: 0ms
memory: 7752kb

input:

500
2509785 939 407 401188 108629 1 195141 1480 912 1030726 1 2 365 8 181 12233 924800 4679947 6 3586 3535348 1 312 1 54 2 165 1 331933 420389 5090 2029739 106107 925214 1024 85 74 2 243051 1596773 291 5 43 23406 28341 998 389 8 6 4 33624 2566 1 362 41 91 425 1 14122 503 1998 53656 465 675 3541239 1...

output:

3
9
13
-1
2
10
16
20
3
13
2
9
4
13
-1
16
14
1
6
1
6
5
5
7
1
3
2
-1
18
-1
7
1
4
-1
15
15
-1
1
5
12
21
14
6
-1
-1
11
6
22
12
2
8
19
20
18
4
1
5
6
16
3
4
19
14
-1
1
19
14
4
1
14
6
11
16
1
2
11
5
6
3
6
6
9
18
2
1
1
-1
1
4
5
19
1
-1
15
-1
10
8
3
13
18
7
3
10
16
12
2
6
7
13
15
30
7
12
8
-1
4
17
-1
9
7
7
1...

result:

ok 500 numbers

Test #47:

score: 0
Accepted
time: 2ms
memory: 7736kb

input:

500
6286522 76220 672178 979 56278 623969 130396 1326 525 1 2 2 6 52574 4671 51 1303 742 9 1040315 818720 1 5061 389 56739 13551 3408 949 238 11 2 3616314 862 178110 25 47 111678 28 3754 24 125 2071357 3 3729000 163132 1993 4793 10000000 445295 1624 781911 395553 324264 3 772349 10000000 10088 733 1...

output:

1
5
46
9
-1
5
-1
18
4
9
11
-1
10
-1
5
8
22
1
-1
4
11
18
4
2
13
5
-1
10
2
4
12
5
2
1
13
9
-1
1
8
7
20
9
1
7
6
6
4
-1
5
8
4
9
4
2
1
13
-1
11
6
2
9
12
17
4
1
-1
9
18
9
9
4
16
8
14
2
17
21
-1
3
7
4
15
5
9
4
9
-1
17
-1
7
9
-1
12
15
4
6
6
11
7
9
20
12
10
10
9
1
2
8
1
5
13
1
1
11
15
2
10
13
13
12
12
6
-1
3...

result:

ok 500 numbers

Test #48:

score: 0
Accepted
time: 0ms
memory: 7616kb

input:

500
36 278282 318962 13455 195131 7517395 10000000 16 2151 6 3335270 4 41112 1734687 355 766 2 1 983 10000000 104 6121 4480029 32 19317 1152173 14 3010 517037 1 14 1 8 1 17 11 3802628 1 3118460 240 159 2 15 152185 6 5093 2 8559 112377 15 1 49984 7 314847 122 8 633 19460 13 11 13311 697276 16682 9471...

output:

8
6
11
1
2
11
17
-1
4
4
18
2
15
10
-1
5
11
20
-1
10
20
9
7
3
-1
-1
-1
7
12
16
3
-1
6
12
15
-1
15
23
15
-1
-1
13
1
4
14
9
12
2
17
6
6
1
21
0
1
8
5
-1
9
1
8
-1
1
1
16
1
0
-1
2
-1
17
-1
5
-1
4
8
22
-1
2
-1
4
-1
11
-1
6
11
21
2
0
-1
16
4
2
-1
3
12
8
3
5
5
11
21
-1
6
3
10
-1
8
8
3
-1
6
-1
7
2
9
-1
-1
12
...

result:

ok 500 numbers

Test #49:

score: 0
Accepted
time: 1ms
memory: 7940kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 58242 1 1 1 58245 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1820 1 1 1 1 1 1 58237 1 1 1 1 455 1 1 1 58242 1 1 1 1 1 1 1 1 3494400 1 1 1 1 58239 1 1 1 1 1 1 1 1 6988800 1 1 1 58245 1 1 1 6988800 1 1 1 58235 1 1 1 1 1 1 58237 1 1 1 1 1 58240 1 1 14560 1 1 1...

output:

6
3
0
43
-1
40
3
21
0
293
37
41
3
31
19
36
42
38
3
2
0
5
0
1
4
399
34
11
3
6
9
16
8
46
1
138
39
-1
39
1
35
-1
2
1
1
12
3
2
3
1
2
43
2
40
39
33
40
12
3
4
4
3
4
10
25
-1
10
16
0
40
18
39
34
15
5
4
47
39
2
6
4
1
2
0
0
-1
39
38
4
1
3
69
3
40
45
40
0
7
1
2
2
36
6
2
37
309
7
1
3
3
261
12
12
-1
40
2
40
39
...

result:

ok 500 numbers

Test #50:

score: 0
Accepted
time: 1ms
memory: 7656kb

input:

500
515618 515570 515559 515601 515606 515613 515597 51570 515604 515559 515568 515637 515643 515585 515578 2 515593 515638 2 515637 515602 515586 515580 515618 515642 51570 515579 1 515550 515639 515617 515547 515563 515593 515559 515641 515590 515612 515620 2 515618 515637 515621 515565 515550 515...

output:

36
3
422
58
64
61
60
58
265
57
10
56
55
26
57
125
10
2
65
55
5
62
-1
413
55
11
61
5
72
118
60
59
50
33
72
8
1
41
59
59
6
8
33
66
11
56
66
31
7
28
2
4
62
2
60
55
57
228
20
58
57
8
63
10
3
7
45
10
147
16
57
2
303
7
55
9
6
2
57
56
3
-1
57
6
90
-1
402
2
31
3
2
4
-1
43
65
57
63
6
35
6
55
64
-1
64
32
59
6...

result:

ok 500 numbers

Test #51:

score: 0
Accepted
time: 0ms
memory: 7612kb

input:

500
339005 339006 339013 339028 339020 339004 339004 339036 339044 339015 56 339027 338995 56 339006 339021 339012 339004 56 56 339019 339006 339029 339001 339002 339040 338998 339009 56 56 339000 339035 3528 338993 339018 339005 339037 339021 339008 339031 56 339018 338997 339040 339019 339024 56 3...

output:

-1
9
78
0
-1
-1
5
14
0
290
91
-1
22
0
0
4
79
-1
82
0
6
0
93
14
89
0
-1
-1
65
324
10
91
-1
15
76
0
0
9
89
79
76
-1
-1
15
-1
-1
0
263
5
79
0
-1
14
-1
145
91
169
449
6
-1
59
0
5
9
84
-1
14
73
66
0
66
-1
2
66
230
14
16
-1
76
-1
0
-1
3
156
-1
0
4
72
75
69
-1
0
92
0
5
-1
-1
11
0
88
0
4
87
-1
10
88
75
-1
2...

result:

ok 500 numbers

Test #52:

score: 0
Accepted
time: 0ms
memory: 7908kb

input:

500
8388913 8389058 8387783 8387900 8388216 16 8388375 8388361 8389428 8389289 8389423 8389207 8388001 8389311 8389262 8387825 8389346 8388850 8388559 8388904 8388178 8389061 8 8388084 8388463 8388551 8387886 8387943 8389115 8388373 8388609 8388528 8388121 8387962 8388998 8388700 8388390 8389186 838...

output:

2
16
0
19
15
13
8
3
11
18
9
15
3
1
3
4
2
6
11
20
0
4
0
9
18
1
0
4
2
6
7
3
18
20
19
3
4
3
8
12
0
1
18
15
13
5
16
9
6
7
12
5
1
0
16
6
16
0
3
29
13
9
1
0
7
3
17
1
2
10
16
1
11
10
0
5
4
5
3
2
10
0
14
4
19
18
17
18
1
14
5
15
4
2
12
5
5
14
0
12
10
9
2
4
10
15
10
0
8
23
8
0
7
10
8
10
9
22
11
0
11
10
3
292
...

result:

ok 500 numbers

Test #53:

score: 0
Accepted
time: 1ms
memory: 7740kb

input:

500
887673 887622 887709 887629 887615 887670 887724 887744 887574 887726 887589 887574 887664 887718 887617 887626 887735 887650 887723 887687 887618 887742 887729 887628 887737 887691 887598 55633 887574 887688 887717 887579 887632 887616 887705 887728 887641 887681 887661 887627 887711 887668 887...

output:

2
14
0
-1
-1
-1
-1
5
-1
22
-1
-1
0
21
8
7
9
21
12
-1
0
3
47
16
-1
-1
-1
16
0
17
50
14
0
0
-1
3
15
415
2
5
5
0
2
7
20
9
11
-1
4
16
20
3
18
3
0
18
10
1
16
4
5
12
6
12
89
11
-1
8
4
-1
3
0
10
3
2
1
0
17
4
2
-1
-1
6
2
1
0
16
-1
4
-1
0
2
-1
0
0
-1
-1
4
0
4
14
-1
3
3
-1
0
4
4
4
-1
-1
16
6
2
19
-1
9
3
6
2
1...

result:

ok 500 numbers

Test #54:

score: 0
Accepted
time: 2ms
memory: 7732kb

input:

500
13 4181 832002 3 1346229 1346297 1346250 2584 317810 987 233 2 5702817 1597 5703357 75019 4181 46368 377 5 3524789 5702690 28656 233 6765 233 28656 3524471 514180 13 196409 21 75026 1 4181 514196 377 55 144 610 377 46370 2 8 144 9228124 2584 89 1597 196405 2584 2178504 831982 9227900 13 832092 2...

output:

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

result:

ok 500 numbers

Test #55:

score: 0
Accepted
time: 0ms
memory: 7736kb

input:

500
42065579 12906 5392761 3236147 297 84142183 63454 1 18 12905 14021164 18 9 1080 158628 28043181 5 1971 63450 1 9 5393688 5 42071104 18819 1080 666192 54 189 3235954 297 84134271 3942 3942 1080 14022935 8628355 5913 95168 27 5393233 12907 1 18 14022846 18 1 158619 412425 18819 54 5913 63452 25379...

output:

5
12
24
17
27
18
5
5
26
30
5
4
23
8
18
12
10
19
-1
35
28
26
28
34
20
18
14
18
13
36
23
41
9
28
11
12
1
6
18
33
17
5
-1
7
21
5
33
25
12
6
36
16
4
21
15
14
18
19
5
21
31
4
34
23
9
21
8
5
27
37
32
12
23
8
7
36
6
9
11
30
18
26
27
11
7
15
6
19
22
5
4
4
33
25
17
12
18
4
17
36
21
4
6
11
12
32
20
14
5
18
16...

result:

ok 500 numbers

Test #56:

score: 0
Accepted
time: 2ms
memory: 7908kb

input:

500
9702710 38633 9796650 9879057 9762962 9744591 9750160 9720736 9835954 9868210 9880934 9865845 9756569 9871419 9714264 9838533 9703537 9892574 9763693 9701437 9791901 9787361 9759846 5 9709573 9726695 9820684 9745872 30 9713473 9765786 9810438 9783817 9721599 9747229 1072 9725539 9830843 9784685 ...

output:

22
3
20
4
3
4
15
18
3
18
12
2
180
2
11
4
28
12
20
33
2
5
0
2
14
24
12
23
16
1
5
28
41
24
34
6
6
-1
27
14
-1
1
39
4
0
4
3
3
8
83
5
72
5
-1
55
1
3
27
1
40
433
38
12
4
-1
-1
18
34
335
0
10
4
41
25
5
16
10
31
22
7
9
36
1
16
20
5
-1
12
41
19
-1
9
17
17
10
40
2
200
1
25
18
1
28
10
17
10
9
9
18
30
3
17
5
1...

result:

ok 500 numbers

Test #57:

score: 0
Accepted
time: 177ms
memory: 22112kb

input:

220000
1 1147681231 350987607 22081230 1849308 30 55 159025018 81 95001 27421911400 720411443 87582917927 2043 2013 89945294479 19446 354346235681 70590725 6 100538 10 15641726967 57019583 123237668 936 35502688 110915735583 11 2077866210 4258 2135925401 1 141720660671 134978368574 640 3665869653 60...

output:

21
1
-1
2
10
25
12
18
3
17
11
1
26
21
-1
13
5
4
11
1
-1
21
23
5
1
14
5
8
4
16
14
5
-1
32
17
31
0
25
13
29
-1
24
20
1
5
7
7
2
-1
13
721
83
10
6
2
13
11
22
13
-1
9
16
31
20
31
3
6
11
13
1
20
9
29
8
9
5
12
5
15
14
18
4
24
17
1
22
3
16
19
21
7
5
-1
12
24
20
40
6
12
-1
6
18
20
4
280
9
10
18
30
19
25
19
2...

result:

ok 13383 numbers

Test #58:

score: 0
Accepted
time: 86ms
memory: 14704kb

input:

219844
751922262958 751943883362 1 1 1 1 1 751923380043 1 751982786520 1 751921961788 1 1 751961612136 751841982942 1 1 1 751927871734 1 1 751912370231 1 751852585230 751851595171 751865439131 751865116173 751962062892 751909491614 1 751880435678 751869426405 751840771120 751918482725 1 751970683064...

output:

-1
6
-1
449
3
-1
-1
-1
2
7
1
5
199
-1
441
-1
-1
17
12
-1
0
2
-1
-1
438
-1
-1
-1
452
442
3
-1
-1
-1
7
4
1
92990
-1
-1
-1
-1
265
1
7
0
-1
8
-1
-1
4
-1
-1
-1
-1
-1
3
-1
445
-1
-1
-1
-1
-1
454
-1
2
441
-1
1
-1
-1
4
-1
493
1
1
5
-1
2
-1
-1
-1
2
-1
0
19
7
65109
-1
-1
2
0
-1
-1
-1
12
10
-1
18
-1
4
4
8
451
...

result:

ok 13304 numbers

Test #59:

score: 0
Accepted
time: 79ms
memory: 16788kb

input:

219985
3747201937 12958 12959 12959 3747348463 12958 3747759256 3747277610 12959 3747131988 12959 12958 3747389308 12959 12958 12960 12959 3747171008 3747339835 3747617274 12958 12958 3747102366 3747840337 12960 3747485656 3747482537 12959 12960 3747327237 3747521901 3747253725 3747359603 3747831805...

output:

-1
6
93034
15
2
24
32742
-1
32733
32827
415
-1
15
12
32751
0
92953
111
15
104
39
16
8
14
18
111
32730
111
15
32834
32729
38
14
15
6
19
266
19
14
112
12
8
19
6
-1
25
92837
7
32742
111
111
54634
6
18
23
104
6
3
112
-1
32834
12
60459
32733
32733
32760
5
2
32832
32729
9
93115
5
4
-1
7
9
-1
93084
-1
25
1...

result:

ok 13432 numbers

Test #60:

score: 0
Accepted
time: 85ms
memory: 20856kb

input:

219982
93879664855 2548 2548 93885316678 93877294859 93878468697 93878993792 93895547519 93877719766 93881193006 2548 93877899295 93894677515 93877308593 93886834705 2548 93895579114 93883808626 2548 2548 93890673822 93882714543 93884003262 93892251718 2548 2548 93880187685 93878161223 93890614438 2...

output:

77749
1481
-1
10
77741
1275
77739
-1
-1
-1
1450
15501
20
-1
4
-1
3
-1
-1
672
-1
38865
-1
-1
-1
0
-1
79010
-1
16
-1
79024
10
4
78389
-1
-1
-1
-1
5
941
-1
12
12
-1
38872
76084
-1
2
-1
0
-1
-1
-1
16
-1
-1
11
79012
24834
11
77738
0
2
0
700
-1
642
1275
275
-1
-1
78375
38884
-1
0
15
-1
12
639
-1
78376
-1
...

result:

ok 13425 numbers

Test #61:

score: 0
Accepted
time: 150ms
memory: 20648kb

input:

220000
549764953568 549716088993 549744189750 549749419185 549786711848 549723390810 549771957606 549742815863 549798428160 549702775218 549770621932 549796181027 549743158195 549717489082 549726731753 549797733405 549788033974 549706396749 549722027213 549781560622 1024 549799054944 549793696715 54...

output:

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

result:

ok 13183 numbers

Test #62:

score: 0
Accepted
time: 132ms
memory: 20832kb

input:

219896
52241977852 52242050650 52245625746 52245047041 52243426693 52240140195 52245226120 52236148000 52238499413 52240417481 52236828825 52243267044 52243392114 52242282715 52242979208 52240737035 52240699836 52237766347 52240434701 52245188669 52242178820 52236425961 52238074100 52237103016 52242...

output:

33
34
0
-1
25
2
23
4
-1
-1
7
12
17
-1
-1
25
1
19
3
10
3
-1
-1
24
-1
12
19
33
23
22
19
11
-1
28
-1
14
9
15
-1
1
-1
20
-1
7
-1
24
1
-1
2
0
24
20
37
5
5
-1
-1
31
-1
31
17
0
6
5
-1
5
33
5
22
11
24
10
21
-1
5
32
11
12
1
21
-1
1
6
11
2
12
23
-1
32
-1
-1
-1
0
13
32
11
29
0
28
29
28
7
10
4
0
28
34
34
6
-1
3...

result:

ok 13414 numbers

Test #63:

score: 0
Accepted
time: 184ms
memory: 15572kb

input:

219870
4181 17711 267919602 6765 701443930 1 267939121 12587207361 610 2178438 610 2178296 55 196410 1135003567 144 10946 139579080106 9227116 514202 610 377 377 610 365467918893 139595194020 2584 9227279 13 377 32949085454 196420 75028 14929370 4807057879 514267 832005 1 75019 165566127 63241372 95...

output:

14
42
39
39
24
17
36
32
54
29
10
48
46
21
7
28
41
36
17
43
16
33
2
20
51
9
4
23
26
35
31
13
11
50
47
35
51
44
41
24
21
33
17
47
36
27
25
21
9
54
27
13
31
33
45
54
17
16
46
19
53
27
50
39
44
41
28
29
47
36
22
50
50
54
6
43
40
50
40
19
41
14
52
40
46
24
19
47
32
30
34
33
16
15
42
20
25
52
50
34
44
47
...

result:

ok 13329 numbers

Test #64:

score: 0
Accepted
time: 168ms
memory: 17328kb

input:

219843
2031169 514423785544 2961388 309923 1569372081 32313655827 5922553 1000000000000 85921 171842 309932 352 999945821369 2031390 1000000000000 171843 1000000000000 8883454 332207407196 999939931737 17664307280 16 64 929832 1 32 1000000000000 960 960 332205583450 5922668 5120 182245267975 5922819...

output:

26
22
12
14
15
12
23
-1
44
11
13
20
22
43
44
45
5
-1
32
36
15
42
22
34
11
15
5
23
46
26
21
44
43
43
32
32
24
37
34
26
36
13
14
16
5
31
43
43
33
20
22
8
44
27
18
15
13
37
36
44
28
5
37
25
8
43
14
40
44
34
44
45
42
46
0
33
46
28
11
43
35
40
19
45
28
27
6
17
19
28
18
38
38
17
19
13
45
17
25
45
34
36
46...

result:

ok 13402 numbers

Test #65:

score: 0
Accepted
time: 148ms
memory: 12140kb

input:

219854
123 334212 1 1 1 999961536215 1 532443574 4788 6 137999427 1 18 36 2175 3 2 123 2 1491 167087 2 3 123 6 4788 69 2 1 1000000000000 123 47745 929683944556 69 334181 2 1491 684 334219 18 438 1491 1 3 123 1491 1 69 8454 999903393121 1 2175 69 1 3 644493 28294800009 2 69 15416 167111 929648970755 ...

output:

23
24
23
38
28
18
11
20
3
21
46
45
26
36
24
33
45
14
39
20
18
15
31
5
25
23
18
19
12
41
18
28
46
16
39
46
39
7
5
26
37
15
22
45
40
45
23
24
35
14
2
36
31
2
45
25
27
24
31
23
13
45
45
31
45
28
44
46
46
5
16
26
34
45
42
46
37
23
46
23
17
33
37
20
44
31
26
13
30
6
43
20
21
15
39
45
26
43
34
45
26
19
28...

result:

ok 20000 numbers

Test #66:

score: 0
Accepted
time: 160ms
memory: 14332kb

input:

220000
1342 9146644902 4 671 1 1 40 1138718930 20 8125 40 242536230 113 1342 131389950 1 186 1342 463334 20 671 372 40 7 1 463347 1 4 13 186 793932254780 4 10105132 1 242549780 448017425 1 3368937 1 1 1 4 12523 4 7 4 4398 813991 9146031515 40 999917518744 242559107 1 2385 51213207887 212874 2 2 4 99...

output:

22
45
37
38
39
21
45
23
32
47
17
28
17
45
37
18
39
43
16
42
35
14
31
4
17
48
27
14
33
44
33
30
24
13
36
34
11
48
36
36
46
47
40
12
24
29
48
17
36
3
13
15
28
36
46
1
37
19
29
17
27
20
45
45
29
3
28
46
47
31
19
38
7
45
47
16
27
20
26
10
41
29
22
37
46
24
48
35
32
16
27
31
22
24
29
24
42
24
21
21
29
26...

result:

ok 18026 numbers

Test #67:

score: 0
Accepted
time: 58ms
memory: 13076kb

input:

220000
195035 21159366138 999999880722 4836 1 115295368 54 4836 96 150 1 20475894 1530 3 396 388619148 1000000000000 1 246 1 3 8 713975642 238514203991 1 496339 992773 8242746295 396 31186 31185 57540 8 57545 1 2418 1000000000000 1 8 8 27 1 3279355 4 31186 3 1000000000000 301315 1 8784 54 1530 888 1...

output:

23
40
2
16
18
20
42
41
25
46
45
37
25
19
23
22
34
10
7
3
41
46
38
14
46
2
0
31
22
20
46
35
44
28
38
24
6
44
41
20
14
21
32
3
12
46
35
32
13
8
22
22
36
45
15
30
4
16
36
44
14
3
35
22
31
47
10
40
-1
47
32
43
37
15
10
45
47
16
43
33
-1
16
42
34
18
16
20
41
45
16
18
27
29
18
46
32
17
42
7
30
34
14
27
20...

result:

ok 1985 numbers

Test #68:

score: 0
Accepted
time: 113ms
memory: 22436kb

input:

219932
999256596863 997157679062 984368154595 10945683 995636515436 999761800285 997922366632 10896101 10830022 10793562 10778880 10878953 10916019 10958094 10916735 997926661161 10812289 10982554 10936791 10930834 984185485365 1000000000000 10926812 991259042019 10948288 990033589376 992777661294 1...

output:

-1
-1
-1
0
0
-1
-1
8
6
-1
6
-1
28
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
7
-1
1
4
-1
-1
-1
0
0
5
-1
3
8
-1
9
4
-1
-1
0
-1
-1
-1
-1
-1
8
3
10
-1
5
-1
7
13
5
1
2
3
-1
0
-1
90407
-1
-1
0
83720
-1
-1
-1
0
0
-1
-1
5
0
1
-1
0
-1
0
-1
-1
7
-1
6
7
-1
-1
-1
-1
-1
4
4
-1
-1
-1
5
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
7
90408...

result:

ok 13298 numbers

Test #69:

score: 0
Accepted
time: 151ms
memory: 24036kb

input:

220000
89727 19898 38003 89520 128727 15088 177691 51120 157403 58506 166131 203339 187815 30387 151453 196625 207594 49127 148536 43873 5582 133168 31804 191723 156299 51927 127691 30999 195522 11181 41102 203265 196019 128581 162521 148911 125419 135755 30297 57003 81469 117125 147757 295 170140 1...

output:

8571
6883
-1
6895
5716
9183
-1
4900
7513
8513
5510
7488
6075
5528
6230
5465
9233
7412
7672
8219
9580
5244
7259
6228
6079
-1
5788
41210
8228
7804
5036
9212
5617
5000
8049
-1
8340
9540
8472
-1
9481
5154
7493
5988
5920
8883
5599
5719
5181
9127
8052
7397
7476
5896
-1
8686
6513
7405
7137
5146
9268
7613
6...

result:

ok 10000 numbers

Test #70:

score: 0
Accepted
time: 206ms
memory: 24288kb

input:

240000
1744 2049 11319 1 930329711459 825 338 1735 18332 2633135 42595419 13 282821 507 62850 1386747508 4156916155 18944162265 525 4 2456 126367977 116584 30310 78237352 538 40866 67618072954 1231860 1509890 2480 644889726 19392083 487955 8175651 7533386286 68751 81 628 88403306 25 16775404187 612 ...

output:

10
22
5
31
9
27
13
7
919
23
8
-1
7
5
1
-1
20
5
13
7
19
4
27
26
28
17
-1
31
23
16
18
8
18
16
18
44
11
25
26
-1
26
4
21
14
3
6
14
5
1733
7
23
7
2
25
-1
30
-1
1
7
12
5
21
7
68
2
7
2
18
392
8
9
14
-1
8
6
31
16
22
5
23
8
25
4
1
14
30
2
8
24
1
37
-1
-1
-1
26
6
30
7
5
6
2
21
-1
20
17
4
917
6
15
11
16
20
23...

result:

ok 17909 numbers

Test #71:

score: 0
Accepted
time: 90ms
memory: 17956kb

input:

240000
658263 658328 750371636175 658342 658268 658317 750350956795 750420819811 658299 658338 658296 750390705919 658349 750417887633 658364 658255 750456064165 750378061160 750434699610 658341 658353 750356177182 658331 750364512414 658254 658321 658337 658296 658341 750338776660 658279 658329 658...

output:

0
-1
-1
3
-1
1
-1
0
-1
-1
-1
366
-1
-1
-1
2
142481
-1
1
-1
0
0
-1
2
-1
-1
-1
-1
-1
-1
3
-1
-1
2
-1
2
2
11
-1
1
3
3
-1
0
2
-1
-1
-1
-1
-1
2
39
397
322
-1
19
0
39
0
1
0
0
2
-1
-1
289
3
-1
0
-1
0
2
-1
-1
-1
-1
-1
208
-1
-1
-1
0
-1
-1
1
-1
-1
-1
-1
-1
467
-1
0
2
5487
107
20
71239
-1
-1
1
0
-1
-1
21
-1
-...

result:

ok 18078 numbers

Test #72:

score: 0
Accepted
time: 75ms
memory: 17168kb

input:

239978
17200 294740179625 294687794219 17201 17201 17201 294717841818 17201 17202 294696057459 17202 17201 17201 17200 17202 17201 17202 294686854176 17202 294714113828 294739606270 17201 17200 294736370490 294745224081 17201 17201 17202 294692840024 294696937061 294702715694 17201 17201 17201 17201...

output:

417
-1
-1
7
0
385
1
156465
0
1
11
0
0
-1
-1
-1
0
2305
109386
156441
768
0
0
155689
-1
109392
-1
155688
392
-1
-1
320
3
378
-1
-1
109405
-1
388
109395
15
109405
0
1
109406
0
108626
0
-1
-1
109391
-1
156455
0
155680
17584
4
-1
155689
0
41846
156445
768
-1
0
-1
775
101371
109390
0
50083
109408
64
10902...

result:

ok 17932 numbers

Test #73:

score: 0
Accepted
time: 90ms
memory: 17628kb

input:

239842
1162535447 1162483624 267 267 267 1162533662 1162449805 1162555790 1162546746 267 267 1162563500 1162533043 1162629581 1162645358 267 267 1162515115 1162473283 1162633195 1162417811 1162537395 267 267 267 1162542505 267 1162466331 1162591089 267 267 267 1162450577 267 267 1162434334 116242356...

output:

28591
28578
2
28591
97411
8
925
28583
28583
28578
0
-1
6
3
10
97417
10
28678
4
3
5
28582
9
-1
1
4
3
-1
28578
28582
1
28585
4
-1
28582
28576
9
3
-1
-1
5
28579
5
97403
2
1
28587
40310
57
40275
28590
28583
4
81
-1
1
28656
-1
28587
8
3
-1
28575
28583
74102
2
3
28593
28583
40280
1
7
41129
1
1
3
28580
9
6...

result:

ok 18046 numbers

Test #74:

score: 0
Accepted
time: 179ms
memory: 19244kb

input:

239975
549788938194 549801529899 549730365269 549765762597 549780941995 549784228641 549783214215 549767789978 549718165181 549786436449 549736014059 549792943186 549761546745 549766440313 549768466558 549722019795 549769099804 549783913691 549764641492 549789649406 549777874416 549746469687 5497649...

output:

0
0
11
30
8
24
38
17
0
26
4
25
35
9
10
12
6
25
9
40
9
10
19
11
6
18
2
1
26
38
8
12
18
27
13
8
31
3
11
0
14
16
5
18
8
28
8
12
2
24
10
5
4
8
0
11
28
5
1
25
24
27
0
1
0
13
22
9
2
7
19
29
14
7
2
6
15
7
17
19
0
1
22
21
11
27
2
11
13
40
6
2
3
24
21
7
16
27
18
39
32
7
4
2
1
7
6
0
15
30
24
12
29
13
1
10
33
...

result:

ok 17916 numbers

Test #75:

score: 0
Accepted
time: 148ms
memory: 21708kb

input:

240000
71626985441 71613929687 71625686827 71621927870 71615421762 71614063229 71624241005 71627400044 71618420406 71623600213 71618990486 71614256633 71627443020 71626790384 71617108836 71615266383 71625135313 71620078450 71624697390 71621403917 71613860547 71618101997 71616103846 71616632156 71621...

output:

9
22
-1
10
2
0
-1
11
38
0
25
7
3
-1
29
2
-1
-1
-1
2
3
-1
-1
0
0
-1
6
-1
-1
24
30
2
0
31
0
30
8
11
21
-1
8
3
5
14
6
23
0
4
-1
7
14
-1
9
1
-1
32
-1
11
22
7
0
2
22
25
25
-1
8
-1
27
38
28
7
13
9
7
13
-1
-1
5
20
0
25
18
17
-1
0
0
18
3
0
7
8
20
-1
2
1
0
8
24
0
-1
-1
28
0
24
32
1
0
1
42
0
0
-1
-1
0
6
24
0
...

result:

ok 17945 numbers

Test #76:

score: 0
Accepted
time: 236ms
memory: 18004kb

input:

239904
46367 433498498 14930256 75020 7778297212 139592846597 139582749902 225865883898 55 46366 3 610 701471471 514274 32949657715 20365708920 5703032 5702612 956768083716 196424 1134790535 4807594826 10945 365437310220 196425 2 591279585674 21 39084726 55 956690698832 987 1597 144 28656 2584 26791...

output:

31
19
47
32
33
15
33
4
29
35
49
21
52
54
29
44
52
31
44
18
18
53
52
16
10
23
45
39
41
18
51
53
43
37
41
12
6
30
8
47
38
51
34
15
21
15
45
15
19
33
9
30
17
25
36
16
49
34
37
35
2
16
24
39
31
38
14
38
15
13
44
53
30
47
-1
24
16
31
42
37
25
22
39
15
45
38
24
25
31
20
18
33
28
21
28
10
25
42
21
15
19
49...

result:

ok 17982 numbers

Test #77:

score: 0
Accepted
time: 180ms
memory: 12916kb

input:

239986
4 4 3554 319 31984 29 1 4 604246496823 1 1 9 11994657 575774 1 575737 9 4 54 191922 1 9 4 28251240086 1 66214285 10662 1 1055616 1 10662 21325 4 1 1 31989 182 4 95967 3 83 3554 16 63978 16 1412615835 1 83 3 319 31986 1777 182 4 1919116 191914 4 54 1 16 4 10662 29 1 3554 10663 1139 3 63977 604...

output:

-1
23
16
38
6
9
45
28
15
38
12
40
27
39
35
30
16
39
24
1
29
35
2
13
39
30
16
17
44
34
3
43
45
15
34
3
31
29
29
43
38
8
45
42
24
45
26
41
31
25
28
32
46
34
15
41
23
34
17
38
16
20
15
6
42
44
19
18
41
45
23
46
35
41
20
17
9
24
36
18
44
10
27
25
40
20
25
18
46
27
14
44
14
36
33
30
20
38
13
24
45
14
23
...

result:

ok 18020 numbers

Test #78:

score: 0
Accepted
time: 187ms
memory: 14860kb

input:

240000
199656717 146 59227852 73 1 999984173098 1460 1 1 28030 219 13 1 2774 146 47 9125 531303 1 1 47 1460 26 8 5 1 9125 93217 9125 9125 1 1 73 531326 1 1460 531254 47 1 1460 73 1 1 4891 73 265650 1 1 657 4891 1 1 93214 1 1 8 47 1 174227937390 3 1000000000000 657 172425 47 19360191473 5 1 3 26 73 9...

output:

28
-1
39
26
33
3
10
18
29
36
26
46
44
18
19
16
12
28
43
19
44
8
22
0
28
14
19
32
17
16
35
26
15
24
40
-1
15
37
37
42
11
2
39
43
5
2
29
17
14
37
34
41
26
38
17
40
33
18
29
22
47
12
41
37
35
38
31
17
22
22
36
37
21
29
19
26
12
31
30
20
15
8
13
24
19
42
41
33
47
17
20
32
5
31
29
46
45
31
15
32
36
19
19...

result:

ok 27000 numbers

Test #79:

score: 0
Accepted
time: 204ms
memory: 14972kb

input:

240000
5784058 4 1 21 46 7 1 3 19756946 1 1 1891 72529849 1 845536 460870 3699142494 10723117 14 1 999950280206 72526990 46 1 1 1 6423 46 845477 979112288 1074 979102407 88 1 3 999943755675 169 4 2139488086 580194562 3247807 46 21 1 88 39848 999932576595 4 250370 1 1 46 169 3458 1074 7 1 169 88 9999...

output:

42
38
23
23
21
44
44
31
5
17
33
39
23
31
38
45
29
30
23
26
41
44
22
16
45
-1
17
23
10
35
45
13
42
28
42
25
21
14
22
26
40
45
30
43
2
42
19
37
41
23
22
37
34
18
37
35
28
29
22
14
45
37
45
39
31
27
11
31
15
38
33
35
8
24
23
2
18
43
21
40
12
15
15
23
36
37
39
3
9
38
6
35
43
37
25
6
45
37
32
14
24
27
37...

result:

ok 24234 numbers

Test #80:

score: 0
Accepted
time: 96ms
memory: 18240kb

input:

240000
5089318528 346041896616 49129 999999142661 999992697152 9 3053304159 19649 3 1000000000000 1317 5088819432 999972110498 1317 999927962146 124403198 324239 5088452606 9825 173022483650 19650 720 17722880 67845488 32 67854816 176833 1017790158 6415223 19649 1000000000000 29474 111943959652 5993...

output:

17
34
18
40
29
8
46
18
28
20
42
31
15
11
36
23
11
16
17
33
27
46
20
41
37
15
13
37
22
14
44
23
27
39
17
42
4
11
38
16
43
19
46
27
14
5
41
37
15
46
22
36
40
25
36
36
23
34
20
45
6
46
45
44
42
15
16
24
24
15
11
37
46
41
36
34
19
46
39
34
39
18
27
28
47
17
39
31
44
46
36
42
13
23
44
23
20
11
33
39
18
4...

result:

ok 2670 numbers

Test #81:

score: 0
Accepted
time: 140ms
memory: 21748kb

input:

239800
771730223815 7205311 7166115 768271212015 7167509 7182449 773051993324 7104700 777858362235 7178923 772140387710 767778182513 772800879130 7129324 779269420490 768159917809 7149106 7130245 768176408490 7189218 777057700956 7092446 768474860121 770137649590 772764130310 7138720 768889667222 77...

output:

2
1
2
21
5
3
3
-1
11
0
7
13
17
39946
23
19
38
18
26
14
7
1
52366
-1
2
5
9
5
-1
2
-1
5
0
-1
-1
3
-1
8
-1
-1
-1
-1
-1
107047
-1
1
-1
4
-1
3
1
1
2
-1
-1
-1
1
3
1
-1
107036
-1
3
3
-1
2
-1
-1
-1
1
4
5
-1
553
0
-1
-1
-1
-1
6
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
0
-1
-1
-1
-1
-1
-1
8
4
-1
3
-1
2
5
-1
-1
-1
-1
-1
...

result:

ok 18037 numbers

Test #82:

score: 0
Accepted
time: 168ms
memory: 22504kb

input:

240000
229830 20953 197012 164370 115596 47724 18734 64450 139161 216200 199261 33033 48166 43204 106324 233432 97661 156579 205421 169182 68624 60309 167636 127112 208893 115442 67076 120510 40318 10844 55190 132710 24055 226524 1603167000 82507 202059 15920 9828 1534537500 126878 30918 189336 9929...

output:

7012
-1
12491
13262
11626
11094
-1
11272
12647
11859
11290
9567
10086
8346
-1
12640
7714
-1
11382
10411
10849
11009
11320
12914
8853
9956
10443
6764
-1
7006
9810
12822
11347
6793
7830
-1
7177
10355
10753
7866
13155
11317
7098
-1
6943
9908
7573
8928
13223
-1
9443
8380
-1
6633
10359
-1
7878
7131
9022
...

result:

ok 13500 numbers

Test #83:

score: 0
Accepted
time: 347ms
memory: 23084kb

input:

260000
1277 11474 336 1 522780 809 8 288997455210 8160030 102936209 94005745 86033226022 1105279 5661313166 97998955405 18018 951770954 416626213 536091805105 16 8 222742169 13968391 640 57762 216447628848 53750798720 66352529 7739893 6250 5 1 17265219703 369739507 59893035 4 8 11 31536 2168386959 2...

output:

11
3
18
7
37
20
-1
10
22
7
9
9
38
31
49
5
20
21
29
12
18
14
16
16
1
4
-1
2
28
30
24
6
30
10
9
2436
-1
6
13
22
9
14
-1
8
10
22
5
25
7
12
3
31
8
16
27
6
6
4
4
20
3
-1
0
453
8
40
21
20
27
-1
1
13
15
19
23
14
2
35
9
8
12
26
27
11
13
18
0
35
3
20
5
2
16
3
-1
4
11
10
30
3
12
22
-1
13
4
6
1
27
26
7
12
935
...

result:

ok 33556 numbers

Test #84:

score: 0
Accepted
time: 110ms
memory: 18112kb

input:

260000
687453653597 687409053233 154231 154216 154213 154218 154211 154228 154219 154210 687381467961 687423935309 687456933925 687397189892 687408621554 687411042628 154224 687403505169 687428581168 154220 687365046025 154237 687448245420 154221 154238 154219 687475859887 687379320674 154212 154225...

output:

0
145609
0
-1
-1
2
70
6
171442
41
0
103
171536
73
171444
51
-1
87
-1
3
1
0
0
-1
11
67
-1
-1
-1
-1
-1
-1
33028
13
-1
4
-1
-1
69
58
-1
0
6
171428
-1
0
12
-1
18
4
-1
17
-1
-1
-1
65
-1
4
21
7
85718
171436
240
101
-1
171448
0
-1
31
99683
0
17
48
4
-1
-1
4
20
-1
-1
-1
-1
0
-1
-1
-1
1
0
-1
0
0
-1
35
-1
20
...

result:

ok 33194 numbers

Test #85:

score: 0
Accepted
time: 121ms
memory: 19232kb

input:

260000
2871220497 2871297599 2871418569 2871515866 44251 44252 44255 44250 2871601356 2871177671 44254 2871623278 44255 2871359250 2871609105 44255 44252 2871505007 44256 44248 2871449186 44256 44253 2871622835 44253 44255 2871651832 2871120866 44253 44248 44248 44252 2871329698 44253 2871633959 442...

output:

18
63
27
30384
13884
2
37286
13817
60
13824
51102
-1
51421
3
31
4
5
7
1
41995
51452
27
13861
25
3
5
29
19
27
29
29
13833
26
3
51427
51107
28
29
40
51106
7
6
30
35720
22514
13857
37611
37300
23431
14
5
5
29
26
45
30
40
30
13
28
29
2
51427
8
51078
30
4
89
3
23818
23816
30
13860
3
30
19
4
25
28
36
1386...

result:

ok 33155 numbers

Test #86:

score: 0
Accepted
time: 126ms
memory: 17924kb

input:

259804
42156 42157 42154 42158 35623935192 42155 42156 42158 35626121768 35625076086 35623505521 35623136965 42158 35628152200 42158 42156 42153 42154 35626108719 42157 42159 42152 35622845401 42157 42160 35628412431 4684 42160 42159 42153 35629569182 42152 42159 42152 35626397020 42156 35627522022 ...

output:

140923
140927
140916
140922
-1
140921
2
3
0
0
-1
58
9
6972
48
-1
35
69
-1
-1
3
33
16
0
0
140884
140883
1
140923
-1
140895
34
140901
140876
222
45
43
140902
140923
140861
1
29
17
40
-1
51
13
-1
4170
-1
140857
140922
43
140864
27
140868
100097
140864
3
0
-1
3
10
8
-1
38802
70416
86256
70444
26
31
1408...

result:

ok 33389 numbers

Test #87:

score: 0
Accepted
time: 271ms
memory: 31880kb

input:

259803
549713621808 549768473392 549713478164 549729312374 549766369267 549802924730 549792852676 549711760093 549727821369 549752434650 549745560761 549737885708 549774986725 549758210227 549797731512 549749508841 549737064202 549792146540 549769872509 549714397135 549783147558 549711418954 5497783...

output:

28
28
10
7
4
27
29
28
15
7
24
20
1
19
15
3
11
1
36
40
24
9
11
16
29
2
24
8
5
2
34
21
0
15
11
20
18
30
28
6
8
2
12
6
10
9
3
8
0
5
2
7
2
17
0
29
0
12
28
7
12
19
10
8
2
7
8
23
7
4
9
6
10
36
8
11
8
18
1
24
9
0
12
28
1
9
3
29
4
38
29
1
18
8
6
27
30
29
17
31
3
8
23
31
2
19
2
35
11
13
10
12
4
28
15
6
28
0
...

result:

ok 33362 numbers

Test #88:

score: 0
Accepted
time: 208ms
memory: 23812kb

input:

259985
25629592029 25630963156 25632885081 25632699086 25632292140 25630956437 25630317452 25632771643 25633070496 25629063563 25630348755 25631078331 25633136377 25630488308 25632043513 25630447836 25630931398 25630308774 25629489916 25629660005 25632461011 25630110997 25632453529 25633205884 25633...

output:

0
36
20
5
-1
20
-1
1
-1
-1
10
21
2
0
32
6
30
10
23
23
-1
0
-1
0
11
9
26
3
19
5
-1
36
-1
12
-1
23
-1
28
-1
14
5
8
0
-1
17
9
10
1
47
17
22
25
13
14
18
-1
11
10
16
4
0
25
7
0
12
31
19
21
32
-1
-1
-1
2
2
19
14
25
0
21
3
6
20
-1
15
0
2
22
-1
9
7
13
30
-1
-1
20
24
-1
16
6
-1
0
20
9
9
16
7
26
4
39
5
-1
7
-...

result:

ok 33465 numbers

Test #89:

score: 0
Accepted
time: 390ms
memory: 16776kb

input:

260000
39087813 317823 12586300193 17710 32954447969 24156640 6765 591341419659 4807779026 8 2178437 4807608032 17712 514238 3 514275 267907774 3 5702414 39087888 24158309 233 377 63249291 53317674645 1346332 317794 1836376065 8 2971068032 514188 377 102331052 75025 144 89 5 102325197 610 14928862 8...

output:

10
45
17
19
22
28
15
15
21
50
39
19
13
52
27
20
26
6
34
35
20
22
19
33
53
36
49
2
11
21
34
54
54
47
44
38
24
47
38
13
35
11
2
38
42
51
45
15
27
48
17
20
53
16
49
32
41
32
48
17
7
46
18
22
28
17
16
23
15
11
41
15
13
51
54
54
22
22
32
54
37
41
29
41
20
18
49
43
25
52
34
17
29
14
46
46
16
35
21
53
44
1...

result:

ok 33413 numbers

Test #90:

score: 0
Accepted
time: 319ms
memory: 17004kb

input:

259964
258970721 1 1209 624798 690 60 7944 1 6 499179393 416548 6248445 6 416556 46284 416520 3818527 258964434 204 1 18745860 6 1 208284 6 1388636 9 1 999984944828 18743935 1 60 1 111 1000000000000 15199 1 18 7944 2429907 1 1 1 9 60 33 3627 1 9 1 23142 3 3 2418 1 416528 18744608 41309969 5010031407...

output:

39
28
2
12
22
22
41
37
14
43
9
25
43
12
45
44
25
27
43
18
41
16
36
42
5
23
45
26
41
35
25
33
38
46
20
28
45
43
32
44
46
27
42
17
35
42
43
46
46
18
-1
46
22
15
30
11
20
44
29
37
-1
46
24
6
42
18
27
38
30
20
34
44
21
33
27
37
43
28
46
10
24
22
19
22
21
35
26
16
40
12
16
39
27
36
20
17
14
26
31
27
45
4...

result:

ok 33482 numbers

Test #91:

score: 0
Accepted
time: 388ms
memory: 16348kb

input:

259772
11099 21134389 925 60678220142 17 20349 2310650377 5 1000000000000 1000000000000 3 1000000000000 1481255373 38114303 925 696792694750 318038776194 2310813473 999931843121 36997 925 9657313459 1258124 999971718682 25 999916415135 237013264 107945691 50 175 1257899 206362400527 414765593 148137...

output:

20
29
31
32
37
15
44
21
21
21
21
24
14
7
46
43
26
26
16
43
31
43
39
34
40
40
40
46
18
45
14
45
-1
6
15
9
35
14
29
12
42
12
43
45
18
15
30
18
34
16
13
34
38
27
26
30
31
45
30
35
15
34
4
29
-1
14
28
23
26
9
37
19
34
18
5
39
46
27
15
-1
41
40
35
40
46
20
19
39
15
18
38
23
37
41
31
8
16
22
37
25
15
45
2...

result:

ok 50000 numbers

Test #92:

score: 0
Accepted
time: 371ms
memory: 17156kb

input:

259993
5 1 10325536 172215890862 676693246 52425 9252 1542 1 1 15254083065 18505 1 5 2 9252 18504 999900475121 2 66210929 157295 6168 23617269315 5 33924 8 33101417 1 348522 90 5 514 1000000000000 90 5 90 2 1028 1 22780461 1 1028 5 3084 257 5 1 1 18504 1 52428 18504 8363898030 3084 1000000000000 1 2...

output:

13
26
47
33
44
41
18
46
21
30
26
41
40
6
21
44
10
44
13
40
9
35
12
45
18
29
18
19
43
9
36
37
14
41
31
20
32
30
33
28
33
25
2
18
33
19
12
47
34
23
33
28
44
44
39
6
18
21
11
26
38
40
44
14
21
26
21
47
24
38
26
42
40
34
20
47
17
24
22
40
13
24
20
17
21
22
37
15
12
20
40
40
28
13
17
45
33
24
36
29
15
44...

result:

ok 44910 numbers

Test #93:

score: 0
Accepted
time: 135ms
memory: 18640kb

input:

260000
3948 1000000000000 567691736921 102408502473 11844 1000000000000 204787991429 70 29186197 204789173800 11211576 17970210 30334365856 29182406 9 999962881609 2510755946 29181197 1000000000000 9 9 5 999936488897 1000000000000 5 1000000000000 5 2510397550 157907 157925 65132065 600073 4453471 20...

output:

27
17
43
33
4
17
43
25
29
18
46
37
38
39
32
43
2
47
45
0
17
12
20
19
42
15
42
46
44
15
42
28
22
37
37
41
44
38
31
22
42
47
44
12
29
11
35
3
37
35
38
29
16
31
11
-1
22
47
12
21
41
39
16
21
43
47
33
13
22
38
41
24
28
-1
29
36
32
20
17
47
28
27
44
14
46
26
45
24
16
26
17
42
20
33
47
40
46
45
47
20
18
3...

result:

ok 4845 numbers

Test #94:

score: 0
Accepted
time: 182ms
memory: 21896kb

input:

259833
885534585777 8166634 8110299 890558957329 893255055545 8233558 8193556 892808040525 8088087 894269567193 890039629482 8125290 880597548531 891091816961 8083465 8100171 8178445 894439198566 893015210275 881500350577 886877522642 8089413 880150822889 888169974861 883383032556 889047688478 88836...

output:

1
-1
39
17
9
16
2
2426
5
19
16
10
4003
107587
20
-1
19
3
22
31
7
16
-1
-1
1
9
8
-1
7
11
3
4
-1
22
29
52891
10
-1
-1
17
-1
-1
18
15
7
-1
-1
2
11
-1
107579
14
18
36
28
18
6
2079
26
16
23
7
38
2
-1
84403
14
1
-1
0
107588
3
18
107590
163
25
19911
107591
9
2
20
2
2
34
6
29
53188
52844
22
24
6
2
-1
6
12
0...

result:

ok 33285 numbers

Test #95:

score: 0
Accepted
time: 272ms
memory: 26828kb

input:

260000
93071 21807 155075 155647 112365 244248 93432 14580 149663 105726 208154 123023 36045 108143 102601 95042 91311 49935 97673 33682 115574 112577 5488425000 155831 61022 170627 255490 97403 226793 175934 56553 36484 139360 76004 92963 150990 90071 112269 164176 116024 36356 233774 248887 321997...

output:

19615
18388
23424
-1
13649
17261
14267
16425
23374
15317
24058
21193
17626
16948
23097
12173
16617
17309
-1
15568
21865
15185
17904
-1
24267
23284
19763
16269
22840
15922
23421
18064
14403
-1
15215
17027
22309
16255
12064
23925
21815
22523
15482
18344
13813
17940
14308
17494
-1
12566
-1
13297
23446
...

result:

ok 25000 numbers

Test #96:

score: 0
Accepted
time: 501ms
memory: 25760kb

input:

280000
153702851074 57 1748970672 2807534 98210847 24929809 18195102914 93745 54228170 11 260717523563 2774483 1052 59333628 119712004589 1190 53890670710 1438061 1 247348685 3 32417823772 754950669 61 93022417 124464638717 38481514 2 6244 3155 47583 3170217996 172234419541 2 3093 507835473 24076148...

output:

13
1
11
27
-1
11
-1
1
31
10
3429
18
36
21
12
14
17
8
24
3
29
-1
11
3
37
17
7
15
16
-1
6
35
8
21
34
-1
11
68
1
6
4
9
16
20
20
5
7
4
32
198
5
10
-1
4
28
12
-1
31
28
7
8
11
22
14
11
11
8
31
23
48
32
13
2
8
14
84
-1
12
8
5
26
3
19
24
17
33
4
18
9
3
33
14
12
4
7
8
3
6
13
1
-1
10
7
17
10
3
1
17
9
-1
13271...

result:

ok 53274 numbers

Test #97:

score: 0
Accepted
time: 199ms
memory: 24484kb

input:

279785
607524718524 6123529 607458768001 6123416 6124174 607545005481 6123804 6123645 6123623 607489481982 607494854210 6123336 607529353287 607490063513 607465860433 607461996952 607455518380 607573095059 607499570550 607532161386 607566131863 607552427699 607500483948 607537686957 6123460 6123094 ...

output:

-1
-1
90
0
6
-1
4
4
5
36
-1
37
50
-1
1
55
2
-1
-1
3
-1
0
2
6
72559
-1
-1
14
2
68
4
7
-1
81
2
-1
-1
-1
-1
72
8
2
151
81673
3
1
36
3
7
1
1
-1
8
55
0
2
-1
2
27
5
23
-1
-1
4
1
-1
1
-1
-1
-1
-1
158
63211
6
-1
0
0
7
-1
99203
-1
7
0
-1
112
2
111
0
15
-1
-1
7
-1
-1
0
0
45
1
38
71
7
-1
6
-1
2
-1
-1
4
93
7
99...

result:

ok 53269 numbers

Test #98:

score: 0
Accepted
time: 175ms
memory: 24508kb

input:

280000
29435462384 29435706793 1 1 29435777188 1 29433211074 1 29432715259 29437988535 1 29434069394 29438210927 29435406237 1 29437891481 1 1 1 1 1 29433371799 1 29436012657 1 29434078561 1 1 29435982335 29435561001 1 1 29435630849 1 1 1 29435003738 29432905896 1 29438204286 1 29432829520 294355427...

output:

70
1
43068
1
47062
-1
13
5
47053
-1
-1
7
55
90131
90132
16
54
-1
64
2
17
13
14
54
5
36
23
12
13
22
90124
90146
11
5
8
26
1
9
79
52
50
76
3
3
47084
47091
13
13
-1
-1
47059
11
25
4
47072
57
-1
15458
6785
90124
21
34
90127
28
43067
12
61
16
90133
90131
90136
5
11
90132
2
90143
90157
90141
4
12
43067
89...

result:

ok 53402 numbers

Test #99:

score: 0
Accepted
time: 164ms
memory: 20476kb

input:

279912
23908394922 1 1 23910106499 23911946953 23910795911 23908343268 1 1 23911352009 23908797485 23909771696 1 23910708945 23910871284 23908025479 1 1 1 1 23912596457 1 23911397038 1 23911252452 1 1 1 23909822031 1 1 1 23911907305 23908700721 23908037253 662828 1 23911940851 23908972618 1 1 239081...

output:

837
-1
3
0
2
839
10
1
6
6
0
1
532
838
836
2
611
0
-1
-1
2
2
-1
15110
209
837
1
-1
3
0
-1
846
10
396
11
12
5
1
8
2
4
39
303
-1
305
6
609
623
1
7
838
840
13
1
617
4
1
617
7
620
7
116
615
0
610
1
6
617
102807
1
687
2
1
309
0
1
126
102807
566
1
520
13
614
835
836
835
274
93112
0
8
837
3
43
834
605
225
4...

result:

ok 53436 numbers

Test #100:

score: 0
Accepted
time: 389ms
memory: 32920kb

input:

280000
549788795292 549800501789 549792682540 549779299660 549727284670 549765928003 549715528277 549754289208 549764013488 549704720063 549774840723 549732030410 549790995786 549800686111 549793022324 549773905579 549770592023 549708233217 549775740834 549796972698 549722677121 549755201783 5498037...

output:

13
7
35
36
24
21
17
32
2
17
32
10
7
20
5
15
1
7
35
0
16
28
14
34
24
17
13
15
22
17
36
14
2
15
3
38
31
33
0
4
32
15
14
20
4
2
8
21
8
9
8
10
14
25
8
0
16
18
9
9
8
29
26
3
37
30
1
4
13
4
12
10
30
5
19
18
9
20
3
2
0
4
2
24
20
30
32
5
5
11
19
0
39
10
17
1
1
9
26
9
22
12
10
7
17
8
5
10
4
0
18
16
8
33
26
1...

result:

ok 53488 numbers

Test #101:

score: 0
Accepted
time: 283ms
memory: 32248kb

input:

279834
49840813820 49834967363 49833309630 49837662769 49836961379 49840571283 49840540629 49832209579 49838760533 49840718834 49837729984 49841515987 49839698576 49831846882 49832866098 49835024192 49834802269 49840525080 49840590957 49841119946 49838258149 49839310003 49836749087 49833953057 49838...

output:

14
-1
-1
-1
-1
1
28
14
9
57
-1
-1
34
-1
-1
-1
11
31
-1
26
-1
1
-1
13
-1
2
-1
-1
-1
2
-1
-1
4
1
33
14
-1
-1
19
18
29
0
3
-1
0
0
13
58
24
19
3
-1
19
-1
2
17
20
3
26
-1
9
10
23
2
10
3
8
19
2
0
1
21
6
26
2
18
30
0
-1
28
-1
-1
12
30
9
0
23
28
4
-1
26
39
15
32
2
-1
27
10
0
-1
-1
31
22
14
22
35
0
25
-1
24
...

result:

ok 53219 numbers

Test #102:

score: 0
Accepted
time: 454ms
memory: 14416kb

input:

280000
1 8 956716627087 610 3 32951878019 2 2 4181 13 1 5 39089107 17711 28656 17712 1346284 317812 34 610 1 5 34 21 1597 121398 987 2 2584 144 1836391088 8 3 5 1 21 514278 10947 2971294524 9227631 28656 5 2 17711 1 196417 1 1 267901016 1 3 13 2 3 3 4181 55 121391 34 6765 5 13 3 13 1 8 165579579 5 8...

output:

20
48
22
50
19
18
16
23
27
21
53
52
27
47
30
39
31
11
40
20
-1
35
30
54
-1
22
43
48
41
15
43
28
25
48
31
18
47
27
17
53
6
21
14
35
20
34
32
19
21
23
38
4
-1
21
25
18
1
22
20
32
22
50
16
13
5
13
12
26
31
22
15
37
28
28
18
23
50
24
22
46
50
51
20
8
20
34
36
53
25
52
46
30
38
29
34
20
16
9
35
29
41
40
...

result:

ok 53528 numbers

Test #103:

score: 0
Accepted
time: 553ms
memory: 17556kb

input:

279997
261187119 2831565 98633816 644803098408 20 4173 1000000000000 1415807 145844 4962657029 7704 8357359841 145841 999900671310 16716562844 3 999915984007 29 3395597962 10479533 14231 177076098789 3 10478419 999945765140 16716068484 63472222945 8357463343 999908775512 1000000000000 8357648536 658...

output:

26
40
32
30
34
19
24
27
47
35
25
45
18
38
25
29
41
21
46
13
17
46
46
46
33
31
46
43
25
47
44
29
20
21
24
45
47
38
4
43
7
23
41
31
47
15
24
19
29
45
45
35
30
33
41
20
17
31
44
37
16
46
24
39
14
16
30
38
22
45
16
35
35
18
21
46
46
26
13
20
33
21
47
37
30
8
46
11
42
33
28
45
38
14
20
27
17
36
18
35
24
...

result:

ok 53248 numbers

Test #104:

score: 0
Accepted
time: 601ms
memory: 19756kb

input:

279727
181302551768 1 15648128 1000000000000 3445332723 1181522120 15648832 4328402 499402 655586582427 27623311244 1000000000000 999904689657 1000000000000 4896 999985561504 655647500898 8976 292983839784 24 618552377 166452 12 832300 55486 7823920 8 1181644402 42023561321 1000000000000 4896 544 24...

output:

6
11
47
40
27
47
38
-1
17
1
23
25
47
35
18
29
14
30
3
39
2
16
19
16
46
42
33
47
32
-1
23
37
24
12
29
36
45
46
31
19
14
46
45
37
47
41
0
6
12
45
26
46
11
15
44
4
1
9
12
38
36
21
3
15
46
46
17
47
47
18
43
13
33
16
10
19
2
16
45
26
18
5
15
36
22
40
34
35
29
10
39
46
14
13
31
26
24
19
27
47
32
23
18
31
...

result:

ok 80000 numbers

Test #105:

score: 0
Accepted
time: 680ms
memory: 20788kb

input:

279942
36833 42809877 96 257668053060 145325044279 61015 1000000000000 209 464997 610 1000000000000 999914250968 145333483100 832201 42813636 2344226291 10999080858 360656125 209 21999958705 24180 360646689 180338250 1734 1124 17 62 4327476194 1000000000000 134665 34 16865679 1000000000000 2827267 2...

output:

17
12
24
31
19
3
10
45
25
30
15
33
41
10
18
18
33
24
7
2
19
7
33
44
26
45
35
46
45
18
4
47
47
15
21
20
27
46
17
36
46
15
25
8
24
36
11
24
7
37
17
15
47
14
43
13
25
-1
27
46
19
28
17
43
8
14
26
43
20
45
25
2
24
15
44
23
45
47
19
3
47
46
47
43
8
1
38
14
44
15
46
43
31
21
47
34
22
47
45
33
44
26
40
38
...

result:

ok 72148 numbers

Test #106:

score: 0
Accepted
time: 147ms
memory: 14376kb

input:

280000
19 56 168 1 1000000000000 54262 999901561495 9 420 1 1000000000000 9576 503440839156 884244 274017931723 1 9 81282686098 420 67284641 999942417007 27130 1 56 9 6 924 1000000000000 168 27134 27134 1 420 261735 1 1 1587871 1 168 252 884128 1 1000000000000 7866089309 1596 187282846 56 8129176796...

output:

27
22
15
26
17
30
29
39
45
41
33
18
29
39
34
40
43
35
38
46
37
40
35
12
26
24
22
45
41
41
40
39
45
21
18
25
25
21
42
35
20
20
44
17
44
22
7
9
45
46
26
17
9
21
34
22
5
18
44
29
29
46
30
28
45
11
35
12
41
27
20
45
23
35
19
46
37
17
19
17
26
9
36
40
2
30
21
38
26
42
20
34
36
46
17
46
38
43
18
26
43
38
...

result:

ok 8000 numbers

Test #107:

score: 0
Accepted
time: 225ms
memory: 23476kb

input:

280000
511680638856 5496720 508504167504 5461320 506203412225 508361977499 506198750789 509984477498 5428766 508466833344 5447864 5472447 5424976 5426509 5428907 5392342 509321926523 506445099694 506160833729 506025810011 506496419443 507019886604 5413377 508555216201 513129702885 5484029 5055016308...

output:

8
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
8
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
1
-1
-1
-1
16
1
-1
-1
-1
-1
-1
-1
-1
5
0
3
-1
-1
-1
89669
-1
-1
-1
-1
4
0
-1
-1
-1
-1
-1
19
-1
-1
-1
-1
0
16
2
1
-1
-1
-1
13
-1
-1
-1
-1
1
-1
6
3
0
-1
0
-1
6
8
-1
11
-1
-1
-1
14
18
7
5
16
-1
6
-1
-1
12
-1
3
-1
45798
2
-1
2
12
11
-1
-1
3
...

result:

ok 53387 numbers

Test #108:

score: 0
Accepted
time: 404ms
memory: 37020kb

input:

280000
206418 124553 81207 62715 27136 78936 38936 109453 267783 272830 252671 2505 47456 18233 59717 92799 207464 93012 155692 201942 220030 152336 44234 63445 14094 76184 261013 264088 124580 236778 56017 153164 108553 241245 236568 85166 22957 212077 110308 205091 171728 179434 219070 93435 10277...

output:

26860
23910
23848
28355
-1
22615
20974
28157
38241
26042
19149
24548
37956
20498
20436
27078
27138
21192
34421
19802
20882
25829
19213
23807
31444
-1
21504
20854
27341
35874
20019
19989
18523
32781
24494
-1
30737
-1
26441
33233
35189
-1
36198
-1
19871
25517
-1
-1
-1
31096
33743
25851
28332
23876
374...

result:

ok 40000 numbers

Test #109:

score: 0
Accepted
time: 619ms
memory: 24312kb

input:

300000
63529 528389 1300 8583 696801 3581 9298874 828274232 1074 10 26725 6272 1746626 681781 245971601114 24426270036 35814151955 6 4 3691132758 728236262 7855103934 2167828 1 65357 34194676055 41 30272929 307095359 475090741390 53 655266521067 218 24628551 11121269 6050762962 172114164102 8531 98 ...

output:

825
28
14
25
1
26
9
20
11
1
2400
12
15
9
6
2
15
4
6
5
10
8
-1
17
8
21
19
1
92
18
24
17
3
2
7
435
18
31
8
30
1
25
27
1
12
10
8
-1
1
-1
15
16
13
35
31
17
8
7
-1
1176
31
7
-1
21
2
3
3
17
31
15
-1
2
1
3
23
30
-1
13
6
23
-1
23
-1
18
7
33
2
24
14
-1
2
10
12
-1
14
18
16
10
9
24
24
23
5
-1
1
-1
7
8
7
26
-1
...

result:

ok 66500 numbers

Test #110:

score: 0
Accepted
time: 231ms
memory: 25288kb

input:

300000
728429189965 3696 728392372413 728409811964 728456811728 728457811968 3696 728421298261 728425646861 728481652386 728438267981 728397073268 3696 3696 728388660387 3696 728365464137 3696 3696 728362549168 3696 3696 3696 3696 3696 3696 728399239960 728399652308 728383517918 728451725649 7283900...

output:

25
14100
101439
101394
101411
101427
101445
75056
43522
36
83313
33
42
101385
-1
2333
6
-1
3700
8
1
26
-1
-1
7
1
101387
0
23
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
50687
-1
23
-1
-1
50710
3
-1
-1
45169
-1
-1
2
6
21382
-1
-1
-1
101394
-1
-1
50698
-1
6
4
4725
-1
49642
0
-1
-1
-1
7
18
100087
2
-1
0
-1
-1
...

result:

ok 66726 numbers

Test #111:

score: 0
Accepted
time: 194ms
memory: 23420kb

input:

300000
212291446127 212306486589 212310276165 212295339789 212292995009 1 1 212318949360 1 1 1 1 212284217774 212299265769 212311229351 1 212296619764 212290927219 1 212313862904 212277995637 1 1 1 1 1 212302259505 1 1 1 1 212292486852 212277916615 212306704381 212288569496 212313279533 212318258410...

output:

8
32393
111101
44561
44
-1
77866
111124
77788
0
79
7
0
11
0
-1
111101
44564
44557
0
-1
66511
55
0
-1
0
-1
88
4260
-1
-1
0
82
44622
-1
-1
54
43
61
44637
44509
30
77864
0
-1
44
0
76
50
64
0
-1
77815
111069
111069
44558
-1
77889
5
5
111069
-1
4
66511
-1
77815
72
-1
-1
44605
0
77878
7
77863
111115
0
446...

result:

ok 66481 numbers

Test #112:

score: 0
Accepted
time: 216ms
memory: 26548kb

input:

299711
32194 33539282805 32196 33541872524 33537487682 33537766725 32196 32193 32195 32194 33536325216 32192 33540300446 33537000755 32196 33538246371 33537382615 33542235758 33538799233 32191 32194 33540817869 33541202999 33540716185 33538236009 32192 33537096332 33539815543 33540061427 33542287371...

output:

130237
130259
31
12
130220
49613
130242
130281
3
14
130246
14
15
130250
130264
65106
130291
19
10
5
130220
-1
14
32
36
4
86502
130228
130252
25
130294
18
20
-1
-1
-1
11
-1
5463
12
-1
-1
16
130223
-1
11
130245
130248
130262
0
130266
8
0
57181
32
12
130251
5
130293
8
3
1
-1
130224
32
14
130263
65110
1...

result:

ok 66416 numbers

Test #113:

score: 0
Accepted
time: 464ms
memory: 31932kb

input:

300000
549741676480 549779751880 549809763367 549787190399 549748437799 549761062541 549807245307 549765400070 549810391965 549787128090 549786482716 549795261594 549748473369 549702245232 549710662104 549709133604 549808170456 549719118868 549802110329 549738102795 549806480029 549721876851 5497251...

output:

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

result:

ok 66609 numbers

Test #114:

score: 0
Accepted
time: 374ms
memory: 32812kb

input:

299975
86576434765 86583932084 86585554469 86581739662 86577112259 86582451198 86582157631 86575688788 86578863020 86585927042 86587640066 86571692542 86571252664 86582307307 86578398861 86580761562 86572144916 86579591112 86575588122 86574877903 86580104662 86582490159 86585112334 86572244290 86581...

output:

5
9
19
7
3
4
13
28
18
9
10
10
7
9
28
22
19
2
26
-1
29
8
-1
10
3
17
0
27
-1
-1
25
16
19
13
13
30
19
-1
6
34
26
2
26
27
8
12
23
31
-1
18
13
30
-1
-1
1
48
4
0
27
-1
0
19
-1
-1
33
10
-1
-1
2
10
3
19
26
12
0
48
-1
44
5
21
34
30
31
33
0
25
7
25
13
5
-1
21
49
24
19
49
18
24
3
15
-1
26
5
3
-1
23
8
1
11
19
6...

result:

ok 66859 numbers

Test #115:

score: 0
Accepted
time: 684ms
memory: 14876kb

input:

300000
24159780 1 34 5 433516433 196401 267912366 987 8 144 21 3 28658 53313710248 13 2 5 1 1 5702753 2178385 5 1 5 34 987 1597 3524293 2 86261872947 34 3524765 1346350 1 233 165568842 1 6765 13 1 1 1 377 5702998 13 5 2 2 987 1 2 987 5 1 55 2 21 317832 34 832069 4181 1 196405 987 987 1597 89 13 1964...

output:

19
19
49
50
39
51
47
28
42
42
37
39
54
24
17
48
52
41
18
42
36
29
26
17
46
19
21
25
33
13
53
42
15
18
10
34
22
21
51
17
28
53
5
51
23
32
40
33
49
35
32
24
51
48
39
53
49
26
52
53
37
24
43
29
10
36
34
29
24
32
54
40
10
32
29
18
48
1
23
32
36
53
45
19
5
27
27
1
29
52
2
19
28
23
38
26
38
32
15
28
11
42...

result:

ok 66592 numbers

Test #116:

score: 0
Accepted
time: 710ms
memory: 24760kb

input:

300000
214 51287725 12463327828 307741322 1 1000000000000 1000000000000 769305870 999933738080 999977306869 330471 153869324 41541096721 20773104458 5969310 1000000000000 999961888196 312 58 2 41541643319 18 1692498375 1000000000000 62320390168 4154622456 999920063119 4 98 373925525682 1000000000000...

output:

44
17
27
39
7
48
20
49
12
43
43
47
44
43
16
31
12
42
45
18
12
30
35
42
20
16
45
48
49
41
44
36
49
29
43
19
15
22
36
42
24
22
24
49
48
22
48
40
2
46
16
37
42
49
14
24
49
22
18
20
16
31
32
48
31
35
44
27
33
49
27
24
28
11
17
45
41
36
49
41
32
9
30
14
18
22
20
25
46
26
46
30
3
15
20
25
30
33
45
32
31
3...

result:

ok 66649 numbers

Test #117:

score: 0
Accepted
time: 714ms
memory: 20600kb

input:

299764
1809720156 904881107 60 80533349419 996395419173 10 999942295209 81950 6 1000000000000 999931308763 1000000000000 999953105689 1000000000000 81942 996245319129 1809719534 45244535266 350 82267325 904960948 22398 7650 27421094 603301164 54840682 90 80541713057 999935761666 12669736788 36193779...

output:

9
21
33
17
37
31
21
26
38
35
36
24
26
12
26
18
32
46
32
24
31
9
29
29
22
43
21
14
41
14
26
35
16
27
9
2
33
33
23
41
13
34
22
37
13
43
40
26
39
39
26
24
6
46
33
18
46
18
30
9
11
42
45
16
12
34
18
31
25
43
46
2
14
18
30
1
34
45
34
41
18
11
45
35
22
27
33
31
43
45
2
2
40
15
39
18
37
35
37
35
32
35
22
3...

result:

ok 100000 numbers

Test #118:

score: 0
Accepted
time: 816ms
memory: 17924kb

input:

299716
11 62 134214783253 999958764971 1000000000000 1000000000000 341642679706 1000000000000 1000000000000 15149650 12201256374 62 1000000000000 207414443489 27167 3881 2033573644 599981 337613 3937801 7874789 7876216 756526684209 12201282759 134220781901 1000000000000 1 27169 87488 31 31 1 113 11 ...

output:

16
17
9
9
26
14
17
15
20
37
26
41
20
42
11
31
40
18
36
22
24
27
25
44
39
16
39
35
14
15
15
33
45
27
33
44
45
12
7
33
42
40
9
35
0
39
20
44
21
40
38
43
21
29
24
21
14
44
32
43
28
21
35
11
45
40
18
24
16
13
42
27
44
39
21
25
15
42
45
28
28
16
31
35
15
44
22
28
27
38
43
11
17
-1
3
44
40
41
18
13
35
45
...

result:

ok 90086 numbers

Test #119:

score: 0
Accepted
time: 220ms
memory: 25252kb

input:

300000
20016933572 4 1000000000000 11453192 999951053993 68709208 30 2290352 57001123662 113997072510 3 285014788570 30 115689 204 3977 11451739 171010488078 204 999967187131 57002615592 284978658966 1 4 999964700383 8 45806936 45810501 4580574 30 6871154 20017954452 36977641000 999959969319 5699502...

output:

16
29
1
29
37
44
17
20
46
11
33
43
18
16
17
17
15
25
39
30
44
15
45
39
9
16
37
13
46
13
45
29
22
32
15
29
20
16
15
39
46
38
28
2
26
17
19
39
43
19
44
6
12
0
36
36
17
30
28
39
1
20
29
27
29
44
46
13
26
20
43
8
9
26
20
45
42
25
30
11
36
22
18
21
37
16
7
31
25
42
46
37
33
36
39
21
46
3
19
34
43
10
15
4...

result:

ok 9980 numbers

Test #120:

score: 0
Accepted
time: 274ms
memory: 32800kb

input:

299989
8719117 941397440420 935835654293 947802350375 8712572 8833773 8789272 935900969210 8817272 8819617 949521186074 938504401738 8878950 952000783109 940504228168 8767238 938305044099 945318633828 8787478 945115480319 948687824763 8810377 8817396 8869460 939705387523 8735515 936386379808 9445583...

output:

7
4
3342
11
0
2
51997
0
-1
-1
-1
0
16
-1
-1
10
-1
-1
-1
8
4
0
1
0
-1
-1
-1
9
-1
-1
2
-1
-1
-1
-1
-1
-1
2
2
-1
-1
44
1
13
1
-1
7
7
-1
-1
0
42
6
3
1
-1
-1
1
179
-1
80
-1
7
-1
4
-1
34
4
9
8
-1
2
-1
31
-1
-1
15
20
8327
69
0
10
8
52788
4
-1
-1
-1
17
-1
2
12
-1
-1
10
5
8
4
-1
-1
-1
-1
-1
1
-1
-1
-1
0
-1
-...

result:

ok 66882 numbers

Test #121:

score: 0
Accepted
time: 478ms
memory: 36460kb

input:

300000
144125 21523 135955 96061 9317750000 207237 90120 99709 138480 165157 113601 24143 193159 82388 97896 219626 296919 45234 245373 83425 68747 295859 204946 193555 106808 38328 9808 246518 30106 137806 101081 182627 110277 36202 64789 120201 60440 292888 151554 97199 12352 186891 28450 18322 28...

output:

31503
-1
40783
37842
23078
41156
28078
38552
32187
27783
-1
35696
29030
36399
26973
40096
46272
35726
-1
31556
36699
32985
29704
38679
33246
38366
31388
29859
37834
47021
39690
28144
43343
24635
23529
44679
44341
46301
30625
40349
-1
26722
47097
-1
-1
24425
29761
38188
46370
30765
23354
43917
34875
...

result:

ok 50000 numbers