QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253279#7215. Optimal BSTSolitaryDream#AC ✓1028ms135004kbC++171.8kb2023-11-16 20:43:412023-11-16 20:43:42

Judging History

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

  • [2023-11-16 20:43:42]
  • 评测
  • 测评结果:AC
  • 用时:1028ms
  • 内存:135004kb
  • [2023-11-16 20:43:41]
  • 提交

answer

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

#define int long long

const int N=4e3+1e2+7;

int n,a[N],p[N],r[N][N];

int f[N][N],d[N],ok[N][N];

int q[N];

void trans(vector<int> &v,int l,int r,int ml,int mr,int *g,int z)
{
    if(l>r)
        return;
    int mid=(l+r)>>1;
    int bm=ml;
    for(int i=ml+1;i<=mr;i++)
        if(g[v[bm]]+f[p[v[bm]]][v[mid]]>g[v[i]]+f[p[v[i]]][v[mid]])
            bm=i;
    g[v[mid]]=min(g[v[mid]],g[v[bm]]+f[p[v[bm]]][v[mid]]+z-d[p[v[mid]]]);
    trans(v,l,mid-1,ml,bm,g,z);
    trans(v,mid+1,r,bm,mr,g,z);
}

void solve(vector<int> &t,int l,int r,int *f,int z)
{
    if(l==r)
        return;
    int mid=(l+r)>>1;
    solve(t,l,mid,f,z);
    trans(t,mid+1,r,l,mid,f,z);
    solve(t,mid+1,r,f,z);
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    d[1]=a[1];
    for(int i=2;i<=n;i++)
    {
        cin>>p[i];
        // p[i] = i - 1;
        d[i]=d[p[i]]+a[i];
    }
    for(int i=1;i<=n;i++)
    {
        vector<int> v;
        v.push_back(i);
        while(p[v.back()])
            v.push_back(p[v.back()]);
        for(auto x:v)
            f[i][x]=1e18;
        int hd=1,tl=0;
        f[i][i]=a[i];
        solve(v,0,v.size()-1,f[i],d[i]);
        // q[++tl]=i;
        // for(int t=1;t<v.size();t++)
        // {
        //     int x=v[t];
        //     while(hd<tl&&f[i][q[hd]]+f[p[q[hd]]][x]>=f[i][q[hd+1]]+f[p[q[hd+1]]][x])
        //         hd++;
        //     f[i][x]=f[i][q[hd]]+f[p[q[hd]]][x]+d[i]-d[p[x]];
        //     while(hd<=tl&&f[i][q[tl]]+f[p[q[tl]]][x]>=f[i][x])
        //         tl--;
        //     q[++tl]=x;
        // }
    }
    for(int i=1;i<=n;i++)
        cout<<f[i][1]<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 2 3
1 2

output:

1
6
15

result:

ok 3 number(s): "1 6 15"

Test #2:

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

input:

3
1 2 3
1 1

output:

1
6
8

result:

ok 3 number(s): "1 6 8"

Test #3:

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

input:

2
1 1
1

output:

1
4

result:

ok 2 number(s): "1 4"

Test #4:

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

input:

10
1 1 1 2 1 1 2 4 4 1
1 2 3 4 5 6 7 8 9

output:

1
4
8
15
20
25
34
50
67
75

result:

ok 10 numbers

Test #5:

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

input:

10
1 2 3 4 3 3 4 3 4 3
1 1 1 1 3 4 3 8 2

output:

1
6
8
10
8
18
23
18
33
15

result:

ok 10 numbers

Test #6:

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

input:

10
3 1 3 1 3 918724234 39934495 159260678 858678333 674749338
1 2 3 4 5 5 5 5 5

output:

3
8
18
24
37
1837448516
79869038
318521404
1717356714
1349498724

result:

ok 10 numbers

Test #7:

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

input:

10
10 10 6 4 6 8 8 3 8 5
1 2 2 2 1 2 2 4 3

output:

10
40
68
62
68
36
74
59
96
93

result:

ok 10 numbers

Test #8:

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

input:

10
5 1 1 3 1 693214231 733513667 158870252 465904460 113578073
1 2 3 4 5 5 5 5 5

output:

5
12
16
27
34
1386428507
1467027379
317740549
931808965
227156191

result:

ok 10 numbers

Test #9:

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

input:

10
77 66 11 70 69 76 39 79 3 90
1 2 2 1 1 2 6 7 5

output:

77
286
385
562
292
306
469
617
520
618

result:

ok 10 numbers

Test #10:

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

input:

10
2 2 4 1 1 567486778 300194941 952337507 33048388 398004889
1 2 3 4 5 5 5 5 5

output:

2
8
20
27
32
1134973598
600389924
1904675056
66096818
796009820

result:

ok 10 numbers

Test #11:

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

input:

10
872 629 628 373 292 691 360 387 326 486
1 1 1 4 2 4 1 6 5

output:

872
3002
3000
2490
3739
5704
3943
2518
7554
5862

result:

ok 10 numbers

Test #12:

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

input:

10
7 4 2 3 4 520178155 25188071 304311123 718362508 862361543
1 2 3 4 5 5 5 5 5

output:

7
22
32
46
65
1040356395
50376227
608622331
1436725101
1724723171

result:

ok 10 numbers

Test #13:

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

input:

10
55060 41083 57162 39952 10080 62536 51144 96561 9101 26870
1 1 3 2 5 2 2 1 3

output:

55060
192286
224444
401462
263609
494904
386801
481551
128322
362216

result:

ok 10 numbers

Test #14:

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

input:

10
1 1 1 6 1 811852559 170628943 851736468 909596922 253223317
1 2 3 4 5 5 5 5 5

output:

1
4
8
23
32
1623705160
341257928
1703472978
1819193886
506446676

result:

ok 10 numbers

Test #15:

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

input:

10
575761857 315989491 170422472 514549720 778045301 507457142 67039637 677797264 414781192 443205007
1 1 2 2 4 5 5 7 4

output:

575761857
1783502696
1492368658
3643141347
4231344646
5741274630
5210508858
7042781739
6936673263
5548518225

result:

ok 10 numbers

Test #16:

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

input:

10
4 3 5 4 1 209751479 614321406 138865360 374150911 217947404
1 2 3 4 5 5 5 5 5

output:

4
14
31
48
56
419503031
1228642885
277730793
748301895
435894881

result:

ok 10 numbers

Test #17:

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

input:

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

output:

11
24
28
48
68
84
92
99
107
136
146
167
177
184
216
227
261
282
291
316

result:

ok 20 numbers

Test #18:

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

input:

20
1 4 2 2 1 2 5 2 4 1 5 3 2 5 4 3 1 1 4 3
1 2 1 1 5 6 7 6 8 4 2 12 2 7 14 12 16 7 11

output:

1
10
19
6
4
10
24
35
22
41
19
21
30
25
41
39
27
46
41
33

result:

ok 20 numbers

Test #19:

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

input:

20
1 1 4 1 3 4 5 1 1 4 247592476 504637986 463480840 494699086 567499933 991226395 93399636 600758796 124250476 192278052
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10

output:

1
4
14
21
32
48
69
78
84
103
495185080
1009276100
926961808
989398300
1134999994
1982452918
186799400
1201517720
248501080
384556232

result:

ok 20 numbers

Test #20:

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

input:

20
7 5 2 4 8 1 1 4 9 3 4 6 7 1 2 6 6 10 9 9
1 2 1 1 4 4 7 3 7 3 1 8 2 8 6 10 12 4 17

output:

7
24
35
22
30
29
29
46
67
42
53
26
74
32
58
52
67
59
51
102

result:

ok 20 numbers

Test #21:

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

input:

20
6 1 1 5 1 4 3 6 1 1 913838590 518212760 40906728 39937719 458476451 764649881 777399843 533980687 920134796 516203399
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10

output:

6
14
18
35
44
61
77
103
113
119
1827677328
1036425668
81813604
79875586
916953050
1529299910
1554799834
1067961522
1840269740
1032406946

result:

ok 20 numbers

Test #22:

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

input:

20
82 92 10 34 48 50 36 30 91 86 76 2 79 88 59 45 97 7 27 95
1 2 1 1 5 6 6 6 9 4 1 10 7 14 2 11 3 16 1

output:

82
348
470
232
260
458
648
628
813
1169
494
168
1571
998
1305
575
867
508
728
354

result:

ok 20 numbers

Test #23:

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

input:

20
4 3 2 1 1 1 1 4 1 1 452668813 977011316 733693494 960254656 281501460 107300807 142607892 338120338 885894141 731499641
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10

output:

4
14
23
29
35
41
47
64
72
78
905337723
1954022729
1467387085
1920509409
563003017
214601711
285215881
676240773
1771788379
1462999379

result:

ok 20 numbers

Test #24:

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

input:

20
33 897 513 914 530 935 453 738 924 472 200 316 341 713 888 724 703 71 22 442
1 1 1 4 5 1 1 1 8 7 1 7 12 4 5 5 12 3 15

output:

33
1860
1092
1894
3901
7236
972
1542
1914
3257
1858
698
2140
2473
4617
6603
6540
1189
1671
6831

result:

ok 20 numbers

Test #25:

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

input:

20
1 5 2 3 4 1 1 1 1 1 410250890 420617609 205120206 423391476 90706691 497481949 756452436 649895145 454719255 381714296
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10

output:

1
12
22
33
50
58
64
70
76
83
820501883
841235321
410240515
846783055
181413485
994964001
1512904975
1299790393
909438613
763428695

result:

ok 20 numbers

Test #26:

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

input:

20
96329 62264 80350 77677 97131 66925 4336 88159 57927 8820 88907 32408 35224 34628 76648 63633 79004 69159 47612 10163
1 1 2 3 5 3 1 6 7 6 6 9 4 3 10 10 9 18 3

output:

96329
317186
353358
612481
724299
1022205
446716
368976
1320838
486332
1444758
1218762
1554885
812694
663652
754020
815504
1694605
1964601
464197

result:

ok 20 numbers

Test #27:

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

input:

20
8 1 1 1 4 6 4 5 1 3 312655739 732314735 588573963 55621715 823538758 476534541 872366893 329703795 172746503 285942432
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10

output:

8
18
22
27
42
67
87
111
121
137
625311649
1464629641
1177148097
111243601
1647077687
953069253
1744733957
659407761
345493177
571885035

result:

ok 20 numbers

Test #28:

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

input:

20
18052341 191335729 643833716 681729917 716990652 961772932 117080623 622695566 78181391 443475516 461970234 929754910 88667411 76119649 907845505 888186021 305189137 660114925 990191415 263492272
1 2 1 2 4 4 3 3 6 4 8 8 2 6 1 8 17 6 14

output:

18052341
418776140
1915831642
1399564516
2062145514
4022892638
2333508020
4014444560
2794209531
6315092118
3023287242
7349871732
4903142359
780403508
7500138838
1812476724
5552707537
8386274098
7664830658
1592895771

result:

ok 20 numbers

Test #29:

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

input:

20
8 1 6 3 1 6 5 1 1 6 7806622 602774539 248603566 767506376 771022160 829806705 977494952 954218636 747411167 835456814
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10

output:

8
18
37
53
60
86
111
120
126
157
15613439
1205549273
497207327
1535012947
1542044515
1659613605
1954990099
1908437467
1494822529
1670913823

result:

ok 20 numbers

Test #30:

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

input:

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

output:

58
128
137
150
158
164
186
195
207
215
222
230
254
264
272
312
324
337
358
384
424
436
444
466
512
537
566
609
621
650
662
678
702
739
751
791
803
812
822
832
842
852
894
906
914
944
987
1023
1054
1065

result:

ok 50 numbers

Test #31:

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

input:

50
4 3 4 1 1 5 2 5 4 1 1 5 4 4 1 5 1 4 5 2 5 2 4 5 2 3 3 4 3 4 1 4 5 4 5 3 1 2 4 4 2 2 5 3 5 5 4 2 5 4
1 2 2 3 1 2 7 8 5 2 10 12 9 1 3 16 13 4 7 6 8 17 4 2 18 23 21 21 22 8 15 4 28 17 19 5 13 27 19 16 38 39 2 38 27 12 9 13 49

output:

4
14
29
20
36
18
23
42
59
41
20
62
81
79
10
48
57
101
38
33
37
53
75
38
23
118
92
54
51
71
50
23
38
74
79
52
41
93
112
55
61
105
137
26
118
116
81
71
105
126

result:

ok 50 numbers

Test #32:

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

input:

50
17 6 1 4 6 7 6 1 6 1 2 5 1 1 6 1 4 5 1 1 4 1 2 1 3 341143496 550858440 800389611 368834409 918846712 672342551 510810999 889305320 712258509 424617908 822229862 8837701 200440446 482374715 133400205 107392639 171038541 922837602 52273769 526216785 830859715 566207031 448610 723130223 940583927
1 ...

output:

17
46
55
72
101
135
170
180
211
222
235
265
276
283
320
331
356
388
399
407
433
444
459
469
491
682287576
1101717464
1600779806
737669402
1837694008
1344685686
1021622582
1778611224
1424517602
849236400
1644460308
17675986
400881476
964750014
266800994
214785862
342077666
1845675788
104548122
105243...

result:

ok 50 numbers

Test #33:

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

input:

50
5 1 10 9 7 1 8 6 7 3 8 1 5 9 3 8 4 2 8 8 6 10 2 4 6 8 1 8 7 2 6 1 2 1 1 6 10 1 6 5 10 9 2 5 4 9 7 2 7 9
1 2 1 4 3 3 6 5 7 4 5 6 5 4 11 3 7 9 16 10 20 19 16 22 1 10 23 2 16 23 11 21 31 15 31 33 12 14 19 6 33 40 21 30 4 36 38 47 26

output:

5
12
38
28
56
51
70
75
84
87
58
66
72
90
46
90
60
84
122
128
114
174
138
114
208
26
94
176
32
106
168
69
130
179
53
200
176
71
122
150
87
173
164
142
128
60
236
81
277
57

result:

ok 50 numbers

Test #34:

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

input:

50
15 1 1 6 2 6 4 5 2 6 1 1 1 1 1 1 6 5 1 1 1 5 1 5 2 549097201 303906322 853620532 656620886 362671653 206512851 329707402 649841178 662545021 37450018 377365717 890089336 837337763 133654164 657751000 637001032 921551876 110227537 500614201 277881360 463029006 215390034 338710208 290160459 6911281...

output:

15
32
36
56
70
96
120
147
162
194
205
212
219
226
234
242
276
307
318
325
333
365
376
409
426
1098194909
607813151
1707241571
1313242279
725343813
413026209
659415311
1299682863
1325090549
74900543
754731941
1780179179
1674676033
267308835
1315502507
1274002571
1843104259
220455581
1001228909
555763...

result:

ok 50 numbers

Test #35:

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

input:

50
45 69 54 39 83 32 22 35 55 25 96 24 75 59 78 99 64 48 74 54 35 87 61 81 98 42 18 8 36 92 53 78 54 70 44 91 93 86 99 87 50 15 85 93 81 82 80 36 65 12
1 2 3 4 1 6 2 5 3 9 1 6 6 13 7 8 5 15 3 15 18 3 13 9 13 21 20 16 17 26 28 4 28 12 31 34 9 35 17 21 39 39 20 29 22 15 43 10 17

output:

45
228
450
621
963
154
252
402
1242
579
1668
138
381
349
689
549
639
1221
989
666
872
1613
687
695
1674
582
979
752
756
1014
818
1100
876
1076
294
1186
1471
1638
605
999
1107
749
959
1053
1098
2028
1007
1180
853
751

result:

ok 50 numbers

Test #36:

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

input:

50
36 6 7 10 5 7 3 8 1 7 1 10 1 1 1 1 2 1 4 2 1 1 2 6 1 805404530 579687874 942189816 748305770 879434779 699838288 707480226 676249068 803134946 208463841 831298076 606963172 497590131 78952772 751830664 598496025 62762164 350865933 338707425 188548290 482384390 126598879 304068157 45916346 3014654...

output:

36
84
111
154
184
224
247
292
306
350
364
421
436
443
451
459
475
484
513
529
538
547
565
605
617
1610809802
1159376490
1884380374
1496612282
1758870300
1399677318
1414961194
1352498878
1606270634
416928424
1662596894
1213927086
995181004
157906286
1503662070
1196992792
125525070
701732608
677415592...

result:

ok 50 numbers

Test #37:

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

input:

50
60 21 406 423 26 282 43 120 748 79 888 912 372 983 826 360 315 402 127 667 148 320 337 135 934 907 722 403 920 264 136 480 21 268 392 570 456 688 11 502 750 638 861 803 616 731 395 739 248 765
1 2 1 1 2 3 1 4 5 2 5 10 5 5 6 3 11 7 6 15 4 2 12 7 15 2 7 21 18 9 18 10 21 31 31 35 7 1 15 29 12 35 4 3...

output:

60
162
1055
966
172
807
1590
360
2945
416
2019
2082
1325
2224
1910
1890
2172
3792
2052
2504
3118
2089
917
3350
3988
4636
1687
2880
6018
4986
4101
5634
558
4070
5760
6294
7656
3496
142
3826
9188
4356
8871
3055
8136
2206
3403
6930
4010
8583

result:

ok 50 numbers

Test #38:

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

input:

50
20 6 1 1 3 1 5 1 1 1 1 4 3 1 1 1 1 4 1 1 6 5 1 1 1 773751352 295277743 862592226 707821824 699142871 762478293 392865264 856656030 56804409 653028406 695395295 615534877 938677832 65534686 676324925 246934416 117671746 221829751 987344903 354149066 130020343 232223887 268814829 213929891 88728371...

output:

20
52
61
66
80
88
114
124
130
137
144
168
188
197
205
214
222
247
256
263
298
329
340
347
355
1547503131
590555913
1725184879
1415644075
1398286169
1524957013
785730955
1713312487
113609245
1306057239
1390791017
1231070181
1877356091
131069799
1352650277
493869259
235343919
443659929
1974690233
7082...

result:

ok 50 numbers

Test #39:

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

input:

50
4453 74861 17211 75173 6670 40219 56069 27687 13589 11564 5855 21631 88198 94863 59179 52244 43879 81368 4644 13693 52505 64266 63648 73493 22837 62318 749 67462 15472 14843 12213 9633 10233 42574 89276 18754 9784 53456 13598 13358 33391 30645 27860 65397 38618 52441 7693 10962 69520 15042
1 2 1 ...

output:

4453
158628
272364
159252
309585
410232
635869
550723
370611
496707
715358
532555
589176
198632
892720
113394
689434
709712
744433
442594
490981
367410
599025
652155
476592
595035
679621
832423
478092
716725
948737
730470
762480
535803
825233
523924
317516
493834
746330
1019824
627128
676766
761919
...

result:

ok 50 numbers

Test #40:

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

input:

50
16 1 1 6 6 1 6 1 1 3 1 1 1 4 1 5 3 3 6 1 5 4 2 3 5 910346965 449473630 61276813 44293042 550075609 268087098 454455925 250915418 672382797 973317441 423100292 714615490 868298898 84108611 431482501 443054286 374498152 708560453 208836801 316107698 441821491 602519996 42841156 555309622 103358521
...

output:

16
34
38
58
84
94
125
136
143
160
169
177
185
208
218
246
266
286
322
333
364
391
407
429
462
1820694479
898947809
122554175
88586633
1100151767
536174745
908912399
501831385
1344766143
1946635431
846201133
1429231529
1736598345
168217771
862965551
886109121
748996853
1417121455
417674151
632215945
...

result:

ok 50 numbers

Test #41:

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

input:

50
605246098 552533225 68586359 888303211 824275089 886788268 559911422 897581958 213606178 186224194 952074152 344815144 967817239 264475557 170810380 624798231 663986714 649318455 75718970 529060643 554343409 43324935 354027261 84242023 392742331 461732108 791255064 542560649 816082481 403969129 4...

output:

605246098
2315558646
3073850948
5249944391
5121888147
6073793166
7817981868
11668507065
3508910405
4467413359
11831983647
7172693034
11233924074
9435795518
13249330543
10850155884
16455910074
10114781998
17498491638
10494135862
16017336854
7690807918
15190277228
13121025891
7124390229
7523443926
136...

result:

ok 50 numbers

Test #42:

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

input:

50
28 6 1 1 1 8 6 1 1 7 8 5 1 6 6 1 2 4 1 1 1 1 1 1 6 970519598 279596730 393904960 400834586 822307779 574194042 609517892 39299193 13084669 652619402 451801971 662810480 496806207 35386057 736945129 186611393 232463855 451819495 42405094 558013468 440919736 425218216 750038795 173830502 534405827
...

output:

28
68
77
82
88
121
153
164
171
208
255
288
298
334
372
384
397
424
435
443
452
460
469
478
516
1941039817
559194081
787810541
801669793
1644616179
1148388705
1219036405
78599007
26169959
1305239425
903604563
1325621581
993613035
70772735
1473890879
373223407
464928331
903639611
84810809
1116027557
8...

result:

ok 50 numbers

Test #43:

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

input:

100
1157 141 141 145 144 142 141 143 6 14 12 14 13 11 10 4 14 14 9 6 9 7 7 13 8 4 11 7 13 8 10 8 14 14 12 7 5 13 8 6 12 8 6 6 12 14 12 9 8 9 4 6 7 12 11 9 5 9 6 8 12 12 9 13 4 13 8 8 6 7 6 11 6 14 14 5 12 14 7 8 8 10 14 8 13 13 1 3 5 1 3 6 1 1 6 2 5 1 1 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18...

output:

1157
2596
3160
3877
4598
5448
6295
7154
7329
7419
7511
7621
7732
7833
7926
7971
8097
8229
8324
8388
8483
8558
8635
8766
8852
8900
9013
9091
9226
9318
9426
9519
9667
9808
9930
10008
10065
10200
10290
10358
10486
10578
10647
10718
10840
10980
11103
11202
11291
11390
11439
11509
11589
11717
11835
11931...

result:

ok 100 numbers

Test #44:

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

input:

100
3 2 5 2 4 5 2 5 4 2 2 4 4 3 4 2 4 5 4 1 5 2 1 4 5 2 4 3 1 1 3 1 5 5 4 3 2 2 4 2 1 1 3 2 5 5 2 1 4 4 1 4 2 4 1 2 4 1 1 4 3 4 2 4 4 2 1 3 5 3 1 5 4 5 5 3 2 4 4 5 1 2 3 3 3 2 3 2 4 1 1 1 3 5 4 1 3 3 2 5
1 1 1 1 4 2 5 2 2 10 10 7 6 11 6 2 15 3 3 12 10 20 9 24 3 9 21 21 2 23 8 10 4 17 7 34 5 36 29 16...

output:

3
10
16
10
14
25
18
31
23
18
27
33
33
39
43
36
23
63
32
24
52
27
29
39
59
27
39
68
61
15
41
39
35
25
39
30
36
24
46
71
42
39
46
53
56
46
43
54
63
46
15
61
53
70
54
42
39
30
30
53
53
48
43
83
83
10
35
61
48
67
42
31
42
82
78
49
18
43
87
48
48
73
27
49
57
57
86
36
29
49
55
29
61
67
74
42
21
64
36
35

result:

ok 100 numbers

Test #45:

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

input:

100
1280 116 124 124 125 125 123 125 126 119 118 124 121 123 122 123 119 119 6 4 8 7 7 8 10 6 4 11 7 6 14 10 14 12 12 13 10 13 3 1 4 1 1 1 6 1 6 1 1 1 226563308 252279089 53259405 45090253 965753421 613405692 906355152 608736439 828354044 133316197 56066645 211886455 414314343 332374833 403589724 34...

output:

1280
2792
3280
3892
4516
5256
5996
6745
7500
8335
9162
10030
10880
11743
12599
13463
14302
15253
15414
15452
15526
15597
15670
15756
15862
15932
15982
16102
16186
16259
16415
16535
16693
16825
16957
17101
17214
17357
17400
17413
17457
17472
17485
17499
17569
17587
17656
17673
17686
17700
453147881
5...

result:

ok 100 numbers

Test #46:

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

input:

100
8 3 1 5 10 2 5 1 1 8 6 4 7 8 5 7 10 3 6 8 1 9 8 4 9 6 1 5 1 9 9 1 2 3 3 7 1 2 2 1 7 3 7 4 9 8 3 4 1 4 2 9 1 3 6 5 6 9 3 3 8 1 9 6 8 2 4 4 2 1 2 7 4 2 1 5 2 5 1 10 5 5 2 2 6 4 6 2 5 2 3 7 5 2 9 6 8 7 6 6
1 1 1 1 1 3 5 6 9 3 1 4 10 4 7 13 7 9 10 11 9 15 19 16 23 26 5 9 12 26 8 20 6 26 7 22 37 28 8...

output:

8
22
18
26
36
20
34
49
25
52
37
24
52
84
46
61
90
49
46
84
47
54
78
66
96
106
116
61
30
54
147
54
100
31
124
61
66
75
74
54
95
49
184
119
72
32
22
81
160
75
31
204
104
55
43
145
113
108
137
129
185
72
62
113
32
60
48
160
74
36
127
81
48
46
74
46
56
165
74
156
193
40
100
114
87
95
120
101
72
50
104
1...

result:

ok 100 numbers

Test #47:

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

input:

100
84 10 6 5 8 8 6 3 9 1 1 6 4 10 4 3 4 3 1 2 10 10 2 2 2 9 7 1 8 6 4 1 1 1 5 5 2 4 3 1 1 1 1 1 1 1 1 6 1 5 437447183 584862942 93588654 323788339 625991752 858862006 455373009 38176353 483719625 395615773 576779879 980699898 245523553 21341192 724290395 801505237 387278570 728535170 456182083 4250...

output:

84
188
216
242
284
327
365
388
442
457
464
502
533
595
629
653
684
709
720
739
807
877
899
915
933
997
1050
1064
1124
1173
1205
1216
1225
1235
1275
1315
1334
1367
1393
1404
1414
1424
1434
1445
1455
1465
1475
1522
1535
1575
874896222
1169727740
187179164
647578534
1251985360
1717725868
910747874
7635...

result:

ok 100 numbers

Test #48:

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

input:

100
56 85 96 36 53 4 20 63 7 96 3 18 6 6 90 46 99 11 93 63 93 56 94 90 24 16 15 11 66 14 42 81 42 85 100 46 67 93 65 6 23 29 91 44 97 25 40 70 65 64 26 52 85 80 2 53 3 6 68 27 92 8 27 21 76 7 46 28 1 64 68 93 46 64 61 66 38 19 59 22 96 6 42 43 53 46 85 68 40 70 19 74 91 29 6 5 72 14 68 18
1 1 1 3 3 ...

output:

56
282
304
184
559
412
675
549
633
900
1008
421
664
633
603
831
654
1040
1457
1305
1457
783
1898
1237
735
1060
142
739
675
733
819
1284
1221
1698
993
1061
246
972
1121
175
382
1112
888
853
1755
740
487
1033
1308
1326
235
1293
446
771
1004
1995
1278
1395
1245
969
607
672
785
1506
840
1024
897
615
103...

result:

ok 100 numbers

Test #49:

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

input:

100
30 5 6 4 2 6 2 3 1 1 6 4 1 6 1 4 1 2 1 2 1 1 1 1 1 2 1 4 2 2 3 1 1 5 1 1 5 1 2 1 1 1 1 1 1 5 2 5 1 3 789172497 251895332 133513192 666744336 815170953 790100715 923961054 282503878 343447087 368475785 109559013 986343565 898335081 359604294 158817579 308199197 225627327 851510364 459422753 33383...

output:

30
70
93
115
128
158
174
194
203
211
247
273
283
320
332
361
372
385
394
409
418
426
435
443
452
468
477
504
521
537
560
570
579
615
626
634
670
681
696
706
715
725
734
744
753
789
807
843
855
878
1578346018
503791688
267027408
1333489696
1630342930
1580202454
1847923132
565008780
686895198
73695259...

result:

ok 100 numbers

Test #50:

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

input:

100
292 726 772 976 128 567 278 338 457 102 877 746 127 38 474 26 668 739 783 456 523 722 793 290 450 677 341 978 480 197 574 924 327 45 581 738 26 437 927 446 928 556 659 800 735 869 729 915 193 187 507 740 145 620 231 538 343 264 114 999 431 330 798 20 390 846 308 776 389 481 754 306 34 836 366 85...

output:

292
2036
4598
5006
840
4188
6204
6996
8310
5676
4808
9460
6066
1082
6792
1046
2876
6972
5568
4912
7551
7536
10393
2070
9134
10691
4567
10744
8402
2953
12206
13256
2194
2656
4648
10783
5448
11795
16333
14016
10006
17012
2858
15952
3010
3278
9398
12073
12494
18503
6276
5455
11491
1824
5448
10183
2226
...

result:

ok 100 numbers

Test #51:

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

input:

100
80 3 5 1 1 1 1 6 5 1 8 1 6 2 8 3 5 3 7 1 3 4 2 5 2 6 1 5 7 1 1 4 6 8 1 3 5 7 1 3 1 1 1 6 1 3 2 1 3 4 434375221 401011627 112527683 701476456 749564001 892952380 82274824 617321199 291657538 905219142 404250406 572452103 159404526 225999785 725158838 685765530 561180883 697842732 599771086 279390...

output:

80
166
184
193
199
206
212
240
268
278
320
333
369
386
434
458
491
516
561
575
597
627
645
683
702
746
759
796
847
861
870
901
947
1005
1020
1045
1084
1138
1152
1174
1185
1194
1204
1249
1262
1286
1304
1314
1341
1373
868752061
802024873
225056985
1402954531
1499129621
1785906379
164551267
1234644017
...

result:

ok 100 numbers

Test #52:

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

input:

100
48966 21523 40412 79083 37603 81102 53095 87692 81909 5498 78633 90386 40709 87511 81789 4246 27023 22376 67921 73716 83907 92721 24803 68169 20607 94938 676 28726 36406 90090 30553 99995 15659 27660 59444 67324 64342 54669 40895 90239 22365 63739 11857 53516 61564 967 99030 44747 67293 45635 88...

output:

48966
140978
283737
552804
275310
545606
483561
273316
573792
108928
255198
564174
179350
889241
375045
993736
413772
523962
347309
358899
265746
1379991
507024
534957
494436
584514
539360
155384
660667
902157
637255
898471
503811
551435
805040
1283613
226616
1691388
555300
1372545
181521
1104349
35...

result:

ok 100 numbers

Test #53:

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

input:

100
31 1 6 1 1 1 5 1 1 2 1 1 1 6 4 5 5 1 5 5 1 3 5 5 1 1 4 1 6 6 3 1 5 3 1 5 4 1 3 4 6 1 1 5 1 1 1 1 2 1 105299714 272467008 639958904 970272896 783654375 519854194 661419670 865450600 93968747 877913861 141226803 928784020 364063119 519576069 609419132 714443652 532747901 401240247 691429479 864587...

output:

31
64
83
93
98
104
127
137
144
156
164
172
180
212
238
270
302
313
346
380
391
411
443
476
487
495
523
534
573
613
637
647
682
706
716
752
782
793
817
848
891
904
913
950
963
972
981
990
1008
1018
210600613
544935201
1279918993
1940546977
1567309935
1039709573
1322840525
1730902385
187938679
1755828...

result:

ok 100 numbers

Test #54:

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

input:

100
147245107 542661327 756266347 793151934 927663603 129148273 367088253 318875892 203795308 448592950 35043015 696307792 869172553 429543910 934977173 879139238 724109446 736778478 539974565 374889098 65671860 956019611 409300839 963698835 287509554 915160668 2375997 555135896 589376629 91786243 1...

output:

147245107
1379812868
3582251996
3656023170
6994408744
8309517166
9023337106
8878700023
8533458271
10991947715
364576244
14544647725
3808064408
1405952186
12930171037
12714132867
14647334421
12337539271
10897151839
9046739641
13904483910
3929823440
17008647223
3997116972
14791834686
15125692211
48929...

result:

ok 100 numbers

Test #55:

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

input:

100
68 7 6 8 7 4 6 4 1 1 2 1 1 1 1 4 2 1 1 6 5 1 5 1 1 4 3 5 1 1 1 3 5 1 1 1 4 4 1 1 6 1 1 1 1 3 1 5 2 1 649410508 68694670 650137878 926232381 284668331 347128441 711860280 52781392 805899319 825997983 554733665 839343760 101708208 432514484 312437520 92181433 767995297 370803144 445736363 94001011...

output:

68
150
175
212
248
275
311
338
348
356
372
381
390
399
408
436
454
463
472
512
549
561
597
609
618
648
674
712
724
733
743
767
805
817
826
836
869
902
914
923
968
981
989
998
1007
1032
1043
1081
1100
1110
1298822329
137390653
1300277069
1852466075
569337975
694258195
1423721873
105564097
1611799951
...

result:

ok 100 numbers

Test #56:

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

input:

200
4158 60 67 68 64 63 62 70 62 65 67 61 68 69 60 67 65 61 61 64 66 60 62 66 63 63 66 68 61 65 65 63 63 69 61 64 60 64 60 64 64 60 64 62 62 64 60 61 69 69 63 60 60 69 67 60 65 69 64 67 69 68 63 60 70 67 60 67 64 69 70 67 68 61 69 64 67 70 67 63 67 63 61 65 60 69 63 68 69 63 60 69 63 60 67 70 70 67 ...

output:

4158
8436
8697
9028
9352
9731
10104
10516
10896
11346
11808
12240
12708
13185
13614
14084
14544
15035
15523
16034
16557
17043
17538
18062
18569
19073
19601
20141
20636
21157
21681
22190
22701
23306
23855
24428
24972
25545
26090
26663
27237
27781
28355
28915
29474
30049
30593
31144
31755
32366
32936
...

result:

ok 200 numbers

Test #57:

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

input:

200
3 5 1 3 5 5 3 1 2 3 2 2 1 4 4 1 2 1 5 5 1 1 1 1 2 1 1 5 4 2 2 4 1 1 1 2 2 1 4 5 5 2 3 3 2 2 2 4 5 1 4 3 1 3 3 4 3 4 3 2 2 4 2 2 4 3 3 5 2 4 1 1 4 1 1 4 2 1 4 2 5 4 4 5 2 4 1 4 4 5 1 5 5 3 4 2 4 2 4 4 4 5 4 1 2 1 4 5 1 3 1 5 4 3 3 1 3 1 3 1 4 1 4 3 3 4 5 2 4 2 5 2 2 3 1 1 5 5 3 2 4 4 2 3 4 2 4 5 ...

output:

3
16
8
30
16
16
30
36
15
30
10
39
36
23
32
41
39
41
48
25
36
12
41
15
39
15
41
61
52
49
39
20
60
33
17
49
51
8
25
61
83
45
30
42
24
51
39
56
84
21
25
72
24
38
33
80
55
32
46
33
62
39
49
18
36
38
45
48
33
48
56
58
55
12
58
56
56
70
39
81
31
32
33
95
36
55
39
72
76
34
22
99
33
30
46
43
45
66
68
70
60
...

result:

ok 200 numbers

Test #58:

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

input:

200
254 1 10 2 1 4 1 8 1 8 1 7 1 7 3 9 9 6 3 6 7 5 3 9 7 10 9 4 6 1 2 3 9 5 5 5 1 3 1 6 10 10 3 7 5 7 4 1 10 8 1 5 4 3 10 4 2 10 4 6 1 6 3 2 10 5 5 1 1 9 10 9 1 1 9 3 2 2 6 3 1 5 1 6 1 2 6 1 1 1 1 1 1 1 1 2 2 4 2 1 224669894 267363866 175237901 319717648 178413200 523994358 129697766 174952184 93290...

output:

254
510
541
558
564
583
592
632
645
688
701
744
757
800
824
880
936
981
1006
1051
1101
1140
1166
1229
1280
1351
1416
1453
1499
1513
1532
1559
1629
1673
1715
1759
1772
1799
1811
1862
1939
2017
2048
2107
2152
2211
2249
2261
2341
2407
2423
2466
2504
2533
2615
2656
2676
2759
2801
2854
2869
2925
2956
297...

result:

ok 200 numbers

Test #59:

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

input:

200
3 7 8 4 4 10 1 2 4 2 7 5 8 5 8 2 7 4 2 1 8 2 2 8 9 7 1 3 10 2 7 9 10 1 6 7 9 5 6 10 9 10 5 4 9 10 10 1 2 10 5 9 7 4 7 5 8 3 2 10 6 6 9 8 6 10 1 5 5 4 10 3 6 1 9 7 5 5 9 6 10 5 1 6 10 9 9 1 2 2 9 9 10 7 7 4 3 7 5 3 3 5 1 10 4 10 8 1 1 4 3 3 2 10 9 7 7 10 3 8 6 8 7 3 1 10 10 4 2 3 1 4 8 6 8 8 9 2 ...

output:

3
20
46
38
54
92
105
48
54
108
75
130
78
103
66
116
151
138
118
62
95
116
166
126
103
75
140
12
146
142
126
184
84
114
147
150
89
166
218
145
121
129
77
153
69
92
132
143
10
92
180
153
83
88
183
69
140
134
73
228
120
197
184
103
166
117
162
168
16
66
190
167
27
178
184
186
220
131
210
103
123
145
12...

result:

ok 200 numbers

Test #60:

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

input:

200
165 1 2 4 3 8 8 1 1 7 1 1 1 8 7 4 4 1 2 2 2 4 1 1 3 3 1 6 1 2 1 6 4 1 6 3 2 5 6 8 7 4 1 5 6 7 7 1 6 4 6 3 1 2 8 8 1 6 5 2 7 1 1 1 6 7 8 3 1 1 5 1 8 1 2 1 1 4 5 1 1 4 6 4 4 4 1 1 6 1 1 1 2 1 3 1 1 3 3 3 375250195 763440448 207442770 537051979 874398868 767460430 166767832 239479395 757050654 2857...

output:

165
332
339
354
370
404
444
457
464
501
514
521
529
577
621
651
679
690
707
723
739
770
781
790
814
839
850
894
907
923
933
977
1010
1021
1067
1094
1112
1152
1199
1258
1311
1346
1358
1399
1448
1505
1561
1576
1625
1661
1711
1740
1751
1770
1835
1901
1917
1967
2012
2033
2092
2107
2117
2128
2179
2239
23...

result:

ok 200 numbers

Test #61:

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

input:

200
17 61 76 24 91 56 17 6 9 78 97 64 71 30 57 2 25 56 54 4 7 76 50 47 22 34 30 46 81 69 6 58 56 42 24 76 28 81 52 30 4 20 72 22 45 90 77 49 66 33 24 8 80 47 90 99 63 32 84 44 22 6 3 52 63 96 28 65 32 23 8 32 31 59 77 57 90 53 55 26 71 38 27 83 44 23 35 20 71 71 75 20 19 36 17 31 73 33 58 17 88 96 1...

output:

17
156
186
327
624
519
768
735
244
390
473
660
1025
558
348
268
885
146
142
582
217
798
411
313
674
1238
294
372
396
492
378
912
528
486
810
1089
552
708
757
324
801
630
983
491
1107
393
1129
1005
1096
582
684
682
379
838
582
1437
759
381
603
307
1262
994
1068
1518
513
1665
675
933
1889
330
483
792
...

result:

ok 200 numbers

Test #62:

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

input:

200
294 14 13 9 12 8 13 12 4 7 9 12 9 8 12 6 10 5 5 7 7 11 13 6 12 6 14 5 6 12 11 11 7 12 9 10 9 11 8 7 7 14 8 7 6 10 13 12 13 6 7 11 5 5 13 11 10 9 6 2 1 1 5 5 1 6 1 1 5 1 4 3 6 1 5 3 1 1 1 2 2 5 1 1 2 1 5 1 2 3 1 1 1 1 4 5 5 1 1 1 632219908 642724690 870864239 450976957 235554065 355068977 8334897...

output:

294
616
669
718
780
832
906
979
1013
1059
1124
1204
1270
1328
1412
1460
1533
1577
1617
1675
1731
1814
1912
1967
2058
2113
2218
2267
2317
2412
2502
2590
2653
2748
2825
2909
2986
3079
3152
3216
3282
3398
3473
3537
3596
3684
3794
3898
4009
4070
4134
4232
4283
4333
4443
4534
4618
4697
4754
4778
4789
480...

result:

ok 200 numbers

Test #63:

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

input:

200
319 681 833 151 506 164 330 926 809 891 38 987 846 379 669 563 108 773 24 162 755 771 161 569 688 937 349 568 471 614 802 986 379 826 3 397 170 328 81 497 539 315 729 366 377 866 666 400 359 189 925 516 995 511 661 42 565 340 942 426 998 930 680 617 955 169 19 739 610 661 138 808 362 928 98 616 ...

output:

319
2000
4666
3134
7017
3941
5250
6137
9490
8568
4261
10978
7152
13454
4338
16085
7955
16925
4419
8873
20932
25016
12609
1776
20664
12684
13361
9856
23548
6456
5859
8457
8200
13119
21702
4644
7201
5244
12289
24432
7116
18223
22126
8161
23832
10714
9421
26212
13394
12336
8274
11421
16613
5793
16397
4...

result:

ok 200 numbers

Test #64:

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

input:

200
295 12 7 5 8 8 6 9 13 5 7 6 6 12 5 11 5 4 11 5 10 12 7 6 5 7 7 10 10 7 6 9 10 7 8 5 12 12 11 13 9 4 10 12 8 9 6 9 14 5 14 11 12 7 8 13 9 10 8 9 4 6 4 1 1 2 3 1 4 1 4 2 5 1 1 6 1 5 1 1 1 1 1 6 4 1 1 1 1 1 1 3 1 1 5 2 1 6 5 1 52527015 843724618 144023704 182047401 132551069 845647311 201246108 699...

output:

295
614
647
674
718
762
800
853
929
967
1014
1058
1100
1177
1219
1297
1339
1372
1450
1492
1565
1651
1708
1757
1801
1857
1916
1993
2073
2132
2185
2260
2342
2403
2471
2518
2614
2711
2801
2905
2982
3023
3107
3206
3278
3358
3415
3495
3610
3662
3779
3875
3979
4047
4121
4235
4320
4410
4487
4565
4606
4660
...

result:

ok 200 numbers

Test #65:

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

input:

200
67113 66096 35748 35461 71497 90153 41683 80396 57698 90554 46931 55912 77402 83706 27678 45038 79250 81513 88140 82299 33603 27089 90730 80952 41923 43945 42562 86069 14175 66318 5719 7343 13440 2889 36103 2955 56424 15822 3593 69146 55123 90969 69422 63158 81561 81008 87458 91073 60488 77349 8...

output:

67113
266418
439758
438897
277220
777330
1004223
560419
679965
580735
812082
941147
1355514
1130292
431751
483831
909039
1185065
770430
918186
606819
583862
1323585
577734
797058
464349
1009229
1576481
697122
1241202
638103
1443687
562054
1425871
440823
590269
1487546
1060347
1011431
715374
497883
5...

result:

ok 200 numbers

Test #66:

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

input:

200
304 13 13 10 9 4 14 6 12 8 8 6 4 6 7 6 14 6 8 10 11 8 7 13 14 9 5 8 11 6 4 13 11 14 13 10 5 9 4 5 13 8 4 5 4 6 8 9 10 8 13 7 10 11 6 9 14 6 4 9 7 9 4 1 5 1 6 1 3 3 1 1 6 1 4 1 1 2 3 6 1 1 3 1 4 1 5 1 6 4 2 1 1 1 1 3 1 5 1 1 985327537 782565009 936502774 440199602 65513758 175092883 661173108 730...

output:

304
634
686
739
788
817
896
940
1012
1066
1122
1168
1200
1246
1301
1347
1443
1493
1554
1628
1708
1770
1827
1923
2025
2100
2144
2213
2300
2355
2393
2497
2587
2698
2803
2886
2935
3012
3053
3098
3203
3273
3313
3360
3400
3457
3530
3611
3699
3773
3883
3952
4039
4137
4196
4280
4401
4463
4504
4586
4656
473...

result:

ok 200 numbers

Test #67:

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

input:

200
195931931 260085001 736400241 596077337 597652191 737632465 582964042 49660948 416523062 274891180 716320252 724779795 50518442 659568350 570905207 498898375 962853857 79770709 458849125 950590762 529554138 173299689 15946347 192631490 804484143 93818011 881553767 490012124 605651795 876666839 2...

output:

195931931
912033864
2840851278
5225423125
2563355178
8034397857
10975707156
3309990213
4410576555
4459215881
5845960788
5862879874
3728806845
8540986090
8274996661
5262702270
9476221240
6050573720
6291780188
6314501808
8150943454
1692017932
6635498710
6900870389
6580710746
1453572898
11871476331
854...

result:

ok 200 numbers

Test #68:

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

input:

200
983 38 37 35 33 38 38 36 33 28 29 29 36 38 28 33 29 30 31 30 32 31 36 37 38 37 36 38 35 31 35 34 35 28 35 32 32 28 35 38 34 31 28 33 34 1 6 1 2 4 3 2 6 1 5 1 5 6 1 5 1 3 6 1 5 6 3 3 3 1 1 1 3 1 1 4 1 1 1 1 3 1 1 1 4 1 1 1 1 1 2 1 1 1 1 6 1 1 4 1 861871189 390745336 980134016 407640566 707402682 ...

output:

983
2042
2191
2368
2538
2758
2985
3203
3406
3607
3816
4023
4275
4540
4746
4982
5194
5431
5676
5917
6170
6418
6697
6987
7287
7582
7871
8174
8457
8712
8995
9271
9554
9807
10111
10396
10681
10937
11244
11573
11874
12156
12412
12710
13015
13057
13112
13128
13149
13192
13229
13254
13321
13338
13398
13415...

result:

ok 200 numbers

Test #69:

score: 0
Accepted
time: 6ms
memory: 19940kb

input:

500
9400 48 45 54 47 53 51 45 50 52 54 47 52 46 47 47 52 44 44 48 50 50 45 52 54 47 48 46 50 54 53 52 47 44 46 45 49 47 44 52 48 51 53 48 52 49 48 45 53 45 48 53 54 47 51 49 54 52 47 52 47 47 46 51 49 46 45 52 46 44 49 52 49 44 48 54 45 50 53 54 50 49 49 49 46 44 44 49 49 45 45 54 47 54 45 49 46 52 ...

output:

9400
18896
19079
19334
19576
19881
20185
20461
20765
21118
21483
21818
22177
22507
22838
23174
23540
23897
24249
24630
25025
25423
25788
26199
26622
27004
27387
27763
28162
28592
29017
29435
29818
30214
30626
31033
31469
31891
32290
32748
33179
33631
34099
34533
34996
35438
35871
36281
36752
37165
3...

result:

ok 500 numbers

Test #70:

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

input:

500
2 1 5 2 5 1 1 2 4 1 5 4 4 5 2 1 2 3 5 4 3 4 4 3 5 5 2 1 2 4 3 5 3 4 1 1 1 5 4 1 3 3 1 4 2 4 1 2 3 1 2 5 4 3 4 4 2 5 4 2 4 5 3 3 3 3 4 2 2 3 4 5 5 2 4 3 5 1 4 4 3 2 3 5 3 4 5 2 3 3 4 5 4 5 1 2 5 1 5 1 3 1 1 2 3 1 2 4 3 5 3 1 2 5 5 3 1 5 1 1 5 2 2 5 4 4 5 1 1 2 1 1 4 4 4 1 4 3 3 2 3 2 4 2 3 1 5 4 ...

output:

2
6
19
13
37
27
10
8
26
6
22
22
17
14
18
10
16
51
57
70
74
17
70
35
41
37
27
15
8
93
18
57
30
26
13
18
36
22
28
21
74
26
10
70
16
20
10
18
29
24
30
24
29
33
17
39
27
40
33
43
52
41
51
39
53
68
29
32
36
87
39
97
75
35
20
46
52
33
41
52
30
21
55
57
27
41
49
30
64
48
39
110
26
24
46
79
69
81
74
24
38
4...

result:

ok 500 numbers

Test #71:

score: 0
Accepted
time: 7ms
memory: 22240kb

input:

500
21634 235 233 237 238 241 233 241 237 239 234 241 240 232 241 241 240 234 233 235 238 236 238 232 231 239 239 233 240 235 241 238 231 233 241 232 241 233 233 231 239 237 231 241 241 232 231 231 241 234 236 240 234 241 231 237 231 241 241 241 233 241 239 239 238 236 235 234 238 235 234 237 234 23...

output:

21634
43738
44672
45851
47040
48472
49878
51317
52743
54406
56049
57728
59403
61035
62718
64405
66086
67958
69823
71705
73606
75495
77397
79259
81112
83021
84933
86803
88722
90607
92535
94442
96300
98394
100545
102636
104791
106894
108991
111078
113223
115355
117440
119600
121760
123857
125938
12802...

result:

ok 500 numbers

Test #72:

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

input:

500
6 6 4 9 7 2 6 8 6 2 4 8 1 7 8 7 4 1 7 7 10 9 2 4 3 8 4 10 7 2 10 10 3 2 9 5 4 3 4 4 9 6 8 6 2 6 5 6 6 10 5 5 3 10 1 1 7 1 9 3 5 4 2 8 8 3 8 2 8 1 1 5 9 4 3 5 3 9 8 2 8 7 6 10 4 7 10 1 1 3 4 5 10 5 5 5 4 5 2 6 3 7 9 9 8 1 3 10 8 9 7 1 8 8 2 8 9 8 1 8 7 10 6 2 4 3 5 4 9 3 8 3 9 5 10 6 2 3 9 2 7 2 ...

output:

6
24
42
30
26
39
24
69
96
36
42
102
106
50
81
130
60
45
99
137
146
57
54
69
57
75
97
110
78
16
65
78
48
128
75
45
72
76
51
87
140
69
112
100
157
97
111
154
188
143
60
82
174
105
89
108
38
59
117
97
137
42
109
84
183
131
61
63
66
153
121
211
147
97
131
176
39
173
215
164
52
210
96
99
197
190
140
54
1...

result:

ok 500 numbers

Test #73:

score: 0
Accepted
time: 7ms
memory: 22276kb

input:

500
10003 284 291 289 289 292 287 294 289 287 289 294 294 290 290 289 291 289 286 293 294 291 285 289 289 290 294 294 285 285 286 292 288 284 290 286 289 289 289 287 293 291 286 293 284 288 286 290 288 287 292 293 285 288 288 287 294 285 291 288 285 287 289 6 10 11 12 7 9 7 9 4 12 11 7 12 9 4 8 9 13...

output:

10003
20574
21731
23173
24618
26361
28087
29842
31581
33591
35612
37660
39709
41742
43772
45800
47840
50149
52440
54774
57116
59441
61727
64038
66352
68672
71019
73368
75657
77945
80241
82579
84889
87447
90049
92625
95223
97821
100419
103004
105631
108246
110825
113454
116019
118609
121190
123796
12...

result:

ok 500 numbers

Test #74:

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

input:

500
44 82 74 81 87 95 3 43 41 37 89 52 93 1 39 42 37 31 64 92 77 23 21 42 81 78 60 3 45 89 84 35 12 30 7 5 71 28 66 3 1 33 25 54 19 39 86 21 6 29 16 55 61 13 45 2 74 41 70 80 66 59 75 7 23 71 5 26 23 25 82 8 92 73 34 26 95 9 89 53 67 15 28 39 12 1 98 12 10 39 52 15 65 93 63 8 65 95 28 9 53 18 31 31 ...

output:

44
252
236
250
528
900
340
744
433
726
553
482
921
999
448
172
911
1111
807
272
529
963
1079
1310
777
1252
786
651
1164
1458
1478
1693
1378
1098
1387
783
1857
958
1473
666
1733
1515
409
1683
922
1141
1169
1233
1382
1558
1213
1504
789
910
669
316
950
1141
1382
1143
1874
526
1150
1583
435
938
870
975
...

result:

ok 500 numbers

Test #75:

score: 0
Accepted
time: 3ms
memory: 22072kb

input:

500
2939 89 85 89 90 90 88 92 84 92 86 94 88 86 92 88 87 84 94 85 90 89 86 94 89 90 90 92 89 89 87 93 85 89 91 89 93 94 89 85 91 86 91 84 91 87 87 91 89 91 90 85 87 15 8 14 14 10 8 11 9 6 12 10 8 6 6 6 16 16 12 8 7 9 10 14 8 6 6 16 7 13 13 6 8 6 12 6 11 12 15 11 7 7 15 11 9 11 10 12 11 16 12 13 14 1...

output:

2939
6056
6400
6841
7290
7824
8354
8901
9413
10047
10653
11301
11919
12523
13162
13782
14398
15073
15811
16495
17210
17920
18611
19353
20065
20784
21503
22235
22950
23663
24366
25111
25800
26594
27405
28202
29027
29860
30658
31427
32240
33018
33832
34595
35410
36197
36980
37796
38598
39415
40225
409...

result:

ok 500 numbers

Test #76:

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

input:

500
888 929 38 294 640 550 835 89 792 714 312 88 129 299 871 774 998 420 834 202 154 340 313 700 4 510 370 823 469 731 543 141 215 185 691 22 576 735 940 456 965 206 122 175 63 257 390 902 176 173 740 708 470 313 657 408 743 423 756 573 747 625 816 246 869 444 48 650 841 655 242 801 455 220 396 140 ...

output:

888
3634
1852
2772
5024
7562
7068
8223
10910
10676
2400
11742
8828
2787
5717
14574
5596
9992
4392
7211
8928
3732
12642
15092
11718
14272
9592
14409
5791
14133
10163
6824
16740
9786
7985
1820
7640
15208
7152
9902
15147
2460
15310
15564
10286
16908
17689
19474
11384
17820
18192
21409
12381
2829
3090
9...

result:

ok 500 numbers

Test #77:

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

input:

500
6849 77 76 76 76 84 86 84 78 83 78 82 85 81 79 77 79 76 80 82 77 81 84 85 76 80 76 86 80 85 77 80 77 82 86 85 79 78 81 76 81 82 82 79 84 76 86 78 78 80 80 85 81 82 85 81 84 86 85 81 86 78 79 85 78 85 76 76 83 82 77 78 80 79 78 84 84 81 86 79 82 85 85 84 86 83 84 78 77 79 85 84 82 82 77 78 81 80 ...

output:

6849
13852
14157
14537
14918
15406
15903
16409
16883
17450
17993
18563
19149
19720
20278
20826
21384
21992
22625
23272
23890
24534
25198
25869
26486
27122
27739
28421
29067
29745
30370
31014
31639
32365
33120
33870
34579
35281
36005
36694
37418
38150
38883
39596
40345
41037
41800
42507
43209
43930
4...

result:

ok 500 numbers

Test #78:

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

input:

500
64657 91301 4731 28787 22234 33659 17846 82028 77225 48284 5327 85196 86810 56611 65345 35383 79704 20267 88668 91698 59173 7890 21213 54563 39791 90966 6873 50259 90588 60410 69874 75883 85151 44929 49727 51066 639 42386 16552 62764 29207 45906 23880 41140 51952 67628 50857 54242 50472 56812 52...

output:

64657
311916
417410
186888
469919
504194
609237
444388
434782
671268
513461
929482
786846
1050123
1076325
986439
439740
618921
785448
312710
1057809
1053382
624853
675696
999663
754965
1049314
919917
791208
759348
420080
1293832
450634
1015077
1340578
665205
494709
531566
929946
871870
608981
127519...

result:

ok 500 numbers

Test #79:

score: 0
Accepted
time: 7ms
memory: 21948kb

input:

500
36925 580 578 577 582 577 577 576 575 581 572 579 582 578 582 574 573 575 572 577 582 575 575 581 580 578 573 574 573 572 582 581 575 582 572 579 580 574 578 579 580 574 573 579 580 580 582 578 582 581 577 581 581 578 582 572 578 577 580 581 578 576 580 576 579 577 580 581 581 577 581 579 572 57...

output:

36925
75010
77324
80210
83118
86581
90043
93505
96960
101016
105029
109076
113141
117191
121263
125289
129308
133905
138484
143097
147740
152344
156944
161585
166224
170850
175441
180039
184631
189216
193871
198520
203126
208345
213496
218696
223903
229071
234268
239472
244683
249853
255011
260218
2...

result:

ok 500 numbers

Test #80:

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

input:

500
756576722 674937783 381834626 299820843 52328354 680442609 378075058 394018678 642381458 783911952 207121820 805676893 889523405 614482888 476429854 245337130 386379249 813780108 395341991 90020619 773717326 502306004 575560568 291754319 648115751 337082201 373862884 704706217 767315950 82576213...

output:

756576722
2863029010
2276822696
4437429322
4946563581
7744468130
4672191967
6874787490
2797916360
5862367419
9253398019
9063310050
11440125325
5283746482
4967256355
3394668712
11414503939
8144480627
4723992766
8784993215
6325851842
5528758480
4385339026
7974832125
7086263001
7657525974
13535793087
8...

result:

ok 500 numbers

Test #81:

score: 0
Accepted
time: 4ms
memory: 22056kb

input:

500
1620 41 45 36 40 45 41 46 46 38 39 39 39 42 41 45 46 43 45 46 36 42 36 41 36 45 36 38 41 44 46 44 44 42 37 44 36 42 44 38 38 42 42 43 39 41 42 45 42 45 1 7 2 10 3 9 5 7 10 2 6 9 7 2 8 3 5 2 9 9 5 2 3 5 9 6 1 7 4 1 9 2 2 9 6 5 7 10 4 8 7 1 10 7 10 5 9 3 3 1 8 5 6 1 1 6 1 6 8 8 6 6 5 10 1 1 1 6 7 ...

output:

1620
3322
3498
3687
3888
4144
4394
4664
4940
5206
5478
5758
6032
6328
6616
6932
7254
7588
7935
8289
8587
8918
9216
9543
9841
10196
10494
10802
11135
11488
11856
12210
12564
12932
13267
13652
13981
14353
14739
15083
15425
15798
16173
16557
16912
17281
17660
18060
18440
18841
18894
18958
18984
19084
1...

result:

ok 500 numbers

Test #82:

score: 0
Accepted
time: 38ms
memory: 36440kb

input:

1000
2496572 7985 7989 7989 7982 7988 7983 7980 7980 7982 7989 7984 7983 7985 7983 7990 7984 7989 7987 7988 7986 7985 7980 7981 7990 7984 7984 7981 7984 7983 7986 7987 7982 7990 7984 7986 7988 7985 7985 7980 7984 7988 7980 7990 7989 7988 7983 7986 7984 7987 7985 7980 7986 7988 7987 7988 7982 7984 79...

output:

2496572
5009114
5041066
5081007
5120924
5168846
5216750
5264635
5312524
5368394
5424304
5480194
5536076
5591975
5647858
5703786
5759680
5823574
5887461
5951356
6015240
6079120
6142965
6206818
6270731
6334609
6398481
6462338
6526211
6590082
6653972
6717871
6781735
6853625
6925474
6997341
7069222
7141...

result:

ok 1000 numbers

Test #83:

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

input:

1000
4 1 5 4 1 5 2 2 1 1 5 2 2 4 5 4 1 5 4 4 3 4 3 2 3 5 2 1 1 2 5 4 3 5 2 5 5 4 5 3 2 5 4 1 2 4 2 3 5 4 4 4 5 1 1 4 4 3 1 4 3 5 1 4 2 1 1 3 3 3 5 3 2 2 1 1 5 2 1 5 4 1 2 2 3 1 3 4 3 4 3 4 1 5 5 4 1 4 4 5 1 2 3 5 4 4 5 2 4 1 1 4 1 5 3 4 3 2 5 4 3 5 4 4 4 5 3 5 5 3 2 5 2 4 1 4 3 2 4 2 3 2 1 4 3 2 2 3...

output:

4
10
18
23
14
42
12
12
26
19
28
35
17
26
18
42
14
62
51
35
42
26
57
63
32
48
45
24
17
26
30
35
39
34
42
37
57
82
106
78
45
42
51
48
75
51
36
23
81
66
35
42
45
42
30
32
54
50
91
51
78
25
42
127
91
51
23
99
69
74
91
57
102
55
42
50
42
53
50
79
127
42
60
63
45
19
82
83
84
34
36
42
100
75
69
68
39
46
88...

result:

ok 1000 numbers

Test #84:

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

input:

1000
80842 498 497 493 502 502 498 494 493 498 493 501 494 501 502 492 502 502 495 502 502 495 493 492 496 497 494 500 495 497 498 499 500 499 499 493 500 494 500 497 500 492 498 498 493 502 499 501 498 502 499 493 492 493 497 495 492 494 502 495 499 500 498 501 501 500 501 500 501 500 497 494 501 5...

output:

80842
162680
164669
167138
169644
172642
175634
178602
181569
185046
188501
191997
195462
198966
202476
205930
209444
213443
217403
221406
225412
229377
233323
237269
241236
245217
249172
253172
257137
261118
265106
269101
273103
277581
282061
286502
290993
295442
299933
304404
308896
313332
317810
...

result:

ok 1000 numbers

Test #85:

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

input:

1000
6 10 8 1 7 3 4 1 7 4 2 2 10 5 10 3 9 2 1 7 10 8 4 6 7 2 10 1 2 8 9 1 1 6 4 6 3 1 9 3 1 8 2 1 9 5 4 10 7 7 6 6 10 8 1 2 3 6 10 1 4 9 5 5 9 4 9 4 4 2 6 4 4 10 10 6 9 8 3 10 4 7 3 4 2 7 6 4 3 1 3 4 1 3 6 8 1 9 10 10 10 7 2 3 8 1 10 8 3 6 6 8 7 4 2 2 3 2 7 8 2 2 5 7 9 8 5 5 8 6 1 4 6 8 7 7 3 6 10 8...

output:

6
32
28
45
56
45
20
66
72
94
106
75
50
97
150
33
60
118
39
153
150
75
48
122
62
56
115
45
48
75
111
106
66
184
94
150
91
87
60
79
87
192
56
52
156
77
56
115
184
107
125
76
99
197
71
200
172
116
127
207
206
157
77
102
72
62
243
130
99
75
80
118
117
115
116
138
101
93
71
98
94
62
90
70
200
129
104
83
...

result:

ok 1000 numbers

Test #86:

score: 0
Accepted
time: 23ms
memory: 36404kb

input:

1000
138528 3136 3140 3133 3134 3137 3139 3142 3132 3142 3141 3133 3135 3140 3134 3133 3140 3140 3136 3132 3140 3137 3137 3142 3132 3142 3140 3133 3132 3141 3140 3138 3140 3137 3134 3137 3135 3132 3139 3138 3141 3132 3141 3134 3135 3141 3135 3139 3138 3139 3137 3135 3140 3136 3132 3137 3140 3142 313...

output:

138528
283328
295884
311556
327228
346043
364875
383719
402521
424498
446477
468416
490361
512337
534281
556220
578202
603309
628392
653452
678560
703656
728752
753880
778946
804074
829194
854265
879329
904456
929578
954685
979807
1008031
1036236
1064462
1092675
1120866
1149107
1177344
1205605
12338...

result:

ok 1000 numbers

Test #87:

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

input:

1000
80 91 36 86 89 27 86 65 46 4 31 86 49 64 87 48 98 75 71 17 56 18 77 97 49 48 27 87 9 26 31 30 22 8 97 65 38 82 82 47 31 3 23 43 81 85 19 97 95 2 4 10 14 96 79 32 80 65 35 51 38 51 81 44 94 81 26 1 69 39 3 66 85 50 43 34 16 85 36 99 51 93 6 41 27 53 17 15 54 90 75 88 54 55 44 91 84 25 35 30 94 2...

output:

80
342
232
520
873
349
685
1184
550
783
911
520
415
1181
687
556
1326
831
1160
444
692
1321
1005
897
1584
256
1532
334
295
499
1797
1026
840
501
695
607
750
665
677
976
1369
615
1116
697
1256
885
828
921
610
795
392
1289
834
352
649
783
1546
1031
1813
1830
1529
648
1035
701
1826
582
212
609
837
2043...

result:

ok 1000 numbers

Test #88:

score: 0
Accepted
time: 8ms
memory: 38392kb

input:

1000
7353 50 53 49 53 52 50 44 52 45 53 45 48 50 46 47 53 52 44 50 51 53 51 51 52 46 49 53 54 48 50 50 53 54 54 47 44 47 44 53 50 44 54 45 44 52 50 46 45 52 52 52 51 52 47 54 48 45 52 53 46 47 52 50 51 49 52 53 54 45 52 50 51 45 51 44 51 49 51 44 50 54 44 49 51 51 53 52 50 51 45 44 47 51 48 49 54 47...

output:

7353
14806
15015
15264
15526
15836
16138
16409
16721
17040
17402
17725
18062
18415
18741
19076
19446
19851
20208
20602
21002
21417
21825
22233
22648
23022
23416
23837
24266
24656
25057
25461
25885
26356
26827
27250
27649
28072
28471
28937
29384
29786
30262
30676
31076
31542
31994
32413
32825
33292
3...

result:

ok 1000 numbers

Test #89:

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

input:

1000
912 163 38 364 756 740 258 950 215 318 602 918 176 63 118 152 708 38 92 105 622 622 266 526 626 906 929 801 547 768 594 229 730 192 442 631 191 356 407 477 767 712 418 792 750 72 972 803 436 430 379 499 466 803 908 174 859 18 64 750 373 106 673 85 927 810 171 664 851 981 941 286 211 638 655 656...

output:

912
2150
1900
2552
5184
4158
3690
7124
4808
5220
4119
8850
5412
3105
5613
10376
8420
4100
10136
10188
6626
8391
6894
8081
3076
13962
14095
13594
12766
6006
9536
8761
12160
3936
3639
8811
2511
5615
5533
2778
12271
8663
7649
5908
11888
9278
12248
5149
4840
6174
8055
10829
4314
6964
12694
8596
13774
12...

result:

ok 1000 numbers

Test #90:

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

input:

1000
153479 890 886 892 889 894 892 886 884 890 894 889 887 884 889 886 887 894 884 887 889 893 886 893 888 885 888 888 892 891 891 888 893 886 891 894 884 890 888 894 893 891 886 888 889 893 888 894 893 884 884 886 888 884 887 885 892 884 891 886 890 891 885 886 893 884 888 892 893 892 884 888 893 ...

output:

153479
308738
312286
316738
321186
326538
331887
337209
342523
348743
354989
361215
367426
373623
379846
386056
392272
399406
406481
413574
420681
427815
434909
442046
449155
456238
463347
470452
477586
484715
491846
498956
506101
514073
522081
530110
538071
546074
554064
562098
570125
578139
586118...

result:

ok 1000 numbers

Test #91:

score: 0
Accepted
time: 3ms
memory: 36336kb

input:

1000
85595 60789 3961 1711 22776 11378 82899 60098 6125 76926 56158 57594 68926 92859 48428 78094 19163 28389 69082 12815 11102 54195 53039 74345 30892 16821 60795 17793 64977 9301 3962 93398 92998 30680 76689 31681 68397 25852 70221 37079 5520 13497 15848 94531 57767 2210 42213 99342 56081 88803 42...

output:

85595
292768
179112
358690
216742
217207
669887
363367
384901
463324
717393
590777
560335
954949
694203
327378
290035
227968
531783
443997
673669
279580
492892
1032693
498148
384238
506922
638889
743850
687286
556098
504937
797028
640959
469585
790413
538966
967582
887035
947352
849694
1047422
67075...

result:

ok 1000 numbers

Test #92:

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

input:

1000
20329 96 94 102 101 92 99 92 98 102 96 93 96 92 93 100 101 96 92 93 101 95 93 94 95 96 98 93 98 95 94 95 100 95 93 99 98 96 99 102 96 95 95 100 100 92 102 100 94 98 102 100 95 100 95 95 94 95 95 98 95 95 102 97 93 93 97 97 99 98 101 94 96 102 93 98 102 102 92 93 102 94 100 102 92 102 92 94 92 1...

output:

20329
40850
41228
41724
42230
42788
43375
43936
44528
45228
45898
46552
47223
47871
48531
49232
49940
50701
51441
52185
52981
53741
54487
55241
56001
56773
57555
58307
59089
59855
60615
61381
62183
63033
63869
64749
65623
66484
67366
68270
69132
69987
70842
71733
72624
73460
74367
75261
76113
76993
...

result:

ok 1000 numbers

Test #93:

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

input:

1000
940300144 278783955 546151521 56390722 93669215 21737031 382712469 673263672 598832289 269684350 232871232 533380436 732630679 427017758 213285664 728945251 103434799 507817577 788010272 715550572 927232800 89425786 396511124 761620718 699502377 969849735 655304569 803555108 719974231 693395998...

output:

940300144
2438168198
4355406716
1993381732
2067938718
2782163246
3197909861
7200133208
3958104800
2970660983
4335626748
5237154360
5834905089
3330825728
4276870044
5823848805
8287136076
10585442856
6001043868
11374087936
6115712948
5259261381
9329966724
14154821058
5432521679
9087003709
8730062656
9...

result:

ok 1000 numbers

Test #94:

score: 0
Accepted
time: 19ms
memory: 38468kb

input:

1000
50612 287 290 294 294 288 290 285 286 290 286 288 284 289 286 288 287 289 294 294 288 288 290 293 285 288 285 290 292 285 286 289 287 291 286 284 288 289 285 285 284 290 292 284 285 291 285 286 288 287 291 284 288 286 294 288 291 286 285 294 287 291 291 287 288 289 288 289 285 284 286 290 290 2...

output:

50612
101798
102955
104414
105884
107613
109351
111070
112794
114815
116821
118836
120830
122852
124858
126880
128896
131201
133537
135875
138178
140482
142798
145133
147421
149722
152010
154330
156666
158953
161249
163566
165869
168477
171050
173608
176196
178792
181361
183926
186487
189092
191711
...

result:

ok 1000 numbers

Test #95:

score: 0
Accepted
time: 195ms
memory: 69236kb

input:

2000
4446999 6278 6269 6277 6278 6277 6273 6275 6273 6278 6275 6277 6269 6276 6269 6276 6269 6278 6278 6276 6269 6277 6269 6277 6271 6269 6278 6272 6278 6268 6277 6268 6273 6278 6270 6268 6276 6268 6270 6276 6269 6278 6273 6270 6273 6272 6274 6268 6274 6270 6276 6269 6275 6274 6272 6275 6271 6273 62...

output:

4446999
8906554
8931639
8963016
8994406
9032060
9069702
9107355
9144998
9188934
9232857
9276792
9320683
9364614
9408506
9452440
9496332
9546545
9596758
9646960
9697119
9747327
9797487
9847697
9897871
9948027
9998248
10048430
10098653
10148807
10199024
10249178
10299367
10355853
10412284
10468698
105...

result:

ok 2000 numbers

Test #96:

score: 0
Accepted
time: 3ms
memory: 69196kb

input:

2000
4 1 2 2 2 1 5 3 2 2 4 1 2 1 1 2 2 1 3 2 2 1 1 4 1 4 1 5 5 1 2 2 1 2 4 4 1 2 1 2 3 3 5 5 1 5 4 1 2 5 4 3 1 4 3 3 4 4 4 3 1 2 4 4 5 3 4 4 4 1 4 1 4 5 2 5 1 5 2 2 3 1 3 3 1 5 5 4 4 2 5 2 5 3 5 2 4 1 2 5 3 5 2 3 4 4 1 1 2 2 4 2 4 5 3 2 1 3 3 2 2 4 1 2 2 5 5 3 2 5 4 3 5 5 2 4 1 1 1 5 4 4 1 1 3 3 4 2...

output:

4
10
12
20
17
26
45
29
30
17
42
53
17
23
32
26
40
32
14
23
39
23
23
32
38
32
14
48
41
32
33
26
28
36
29
32
39
33
28
39
45
55
74
59
29
47
57
10
60
41
74
25
34
70
60
45
78
45
41
26
44
50
42
32
66
45
78
62
50
49
48
83
48
65
60
67
57
25
46
43
36
34
45
60
56
61
45
58
58
39
45
53
98
59
61
36
32
26
36
47
7...

result:

ok 2000 numbers

Test #97:

score: 0
Accepted
time: 100ms
memory: 69192kb

input:

2000
485761 1601 1597 1601 1602 1598 1602 1599 1601 1603 1604 1599 1598 1602 1602 1599 1605 1598 1597 1597 1598 1596 1599 1598 1603 1601 1600 1600 1596 1604 1597 1603 1598 1603 1605 1605 1598 1601 1602 1599 1602 1596 1606 1596 1604 1598 1601 1597 1601 1598 1596 1601 1604 1602 1605 1606 1599 1602 160...

output:

485761
974724
981116
989117
997126
1006716
1016324
1025921
1035527
1046740
1057960
1069155
1080342
1091555
1102769
1113967
1125200
1137985
1150762
1163541
1176325
1189099
1201890
1214678
1227497
1240304
1253105
1265907
1278680
1291510
1304293
1317118
1329908
1344323
1358752
1373183
1387566
1401970
1...

result:

ok 2000 numbers

Test #98:

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

input:

2000
8 8 9 8 10 7 5 2 4 1 3 1 3 6 6 8 7 9 3 9 2 2 1 1 5 1 7 6 6 1 9 7 6 1 8 2 6 9 6 7 3 3 3 9 6 8 10 8 10 1 8 5 9 3 8 1 6 10 3 8 4 8 1 1 10 5 2 10 2 3 7 4 3 10 7 5 5 2 8 10 6 5 4 3 9 8 10 6 3 2 10 2 4 8 1 7 4 10 2 10 8 3 5 9 6 9 7 7 1 3 9 2 8 8 5 10 4 3 10 3 6 5 4 3 8 9 8 3 6 2 5 2 8 9 6 2 2 10 2 1 ...

output:

8
32
66
32
105
61
135
123
81
18
127
22
33
93
56
48
59
45
65
50
107
140
43
59
119
18
96
84
28
18
182
85
84
66
43
20
85
45
72
30
103
140
103
182
84
64
65
161
68
22
118
88
45
63
116
129
139
145
78
203
36
121
196
130
36
55
78
117
200
33
220
31
118
64
93
90
149
52
111
108
162
84
208
56
142
102
155
112
68...

result:

ok 2000 numbers

Test #99:

score: 0
Accepted
time: 95ms
memory: 69132kb

input:

2000
12670059 75398 75395 75392 75394 75391 75392 75396 75395 75391 75391 75398 75398 75395 75397 75388 75398 75389 75395 75390 75391 75390 75389 75395 75390 75390 75389 75394 75396 75393 75390 75388 75397 75393 75388 75398 75388 75391 75390 75393 75388 75398 75394 75393 75392 75389 75392 75393 7538...

output:

12670059
25490914
25792497
26169460
26546434
26998783
27451135
27903510
28355883
28883621
29411358
29939134
30466915
30994683
31522460
32050186
32577972
33181088
33784241
34387365
34990492
35593617
36196730
36799886
37403011
38006137
38609255
39212411
39815578
40418727
41021852
41624966
42228143
429...

result:

ok 2000 numbers

Test #100:

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

input:

2000
51 37 100 14 15 73 37 1 42 45 39 88 75 97 34 37 39 1 4 35 80 74 93 76 39 13 34 68 52 100 59 53 22 97 26 72 21 68 32 98 38 70 44 9 27 82 13 78 17 45 75 86 55 95 9 79 2 41 55 82 5 50 64 92 16 61 37 67 46 19 38 8 13 94 74 84 10 38 52 48 31 52 6 3 14 39 15 4 24 13 37 22 89 5 81 10 97 24 40 9 78 77 ...

output:

51
176
302
130
132
341
255
104
273
441
330
655
345
551
315
854
498
541
331
519
597
304
381
595
180
782
686
881
740
1183
1127
633
468
637
1316
959
975
292
240
1049
633
1037
706
675
999
765
420
641
770
279
603
711
962
579
519
495
725
597
858
266
159
767
765
974
462
1307
676
1058
1459
800
1065
569
441
...

result:

ok 2000 numbers

Test #101:

score: 0
Accepted
time: 93ms
memory: 69192kb

input:

2000
21512445 84036 84031 84033 84037 84033 84037 84037 84034 84031 84031 84035 84038 84038 84037 84037 84029 84031 84037 84034 84036 84030 84033 84033 84034 84030 84035 84029 84031 84033 84033 84031 84037 84033 84028 84035 84033 84034 84037 84031 84028 84031 84032 84033 84029 84030 84036 84033 8403...

output:

21512445
43192962
43529091
43949254
44369438
44873634
45377852
45882073
46386280
46974499
47562716
48150960
48739220
49327483
49915743
50504002
51092214
51764460
52436744
53109012
53781297
54453543
55125808
55798075
56470347
57142594
57814875
58487115
59159369
59831637
60503906
61176160
61848457
626...

result:

ok 2000 numbers

Test #102:

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

input:

2000
180 344 523 897 807 937 802 739 201 268 504 531 148 77 26 935 405 596 988 967 546 330 383 324 92 721 812 972 398 336 470 44 595 516 667 692 523 688 283 262 822 597 495 87 223 58 443 404 697 732 539 398 93 582 409 878 746 883 21 585 579 582 651 772 716 400 608 896 69 514 581 175 757 62 554 548 5...

output:

180
1048
1406
2154
4845
2234
3176
3587
1974
5130
3687
5804
2619
1623
3249
5101
4644
3891
8797
6326
1452
5316
6801
5298
4487
10041
6836
4053
8842
5495
4839
2130
5214
7768
9649
4284
11332
4727
6778
2589
8299
7827
3214
1653
6705
3083
4117
5538
4886
7172
4429
7230
1671
7747
7447
10416
4191
7428
7712
969...

result:

ok 2000 numbers

Test #103:

score: 0
Accepted
time: 102ms
memory: 69160kb

input:

2000
10584639 84113 84120 84115 84123 84119 84122 84117 84115 84114 84118 84122 84116 84119 84119 84116 84120 84115 84118 84123 84113 84113 84122 84120 84119 84115 84119 84119 84117 84115 84116 84123 84117 84115 84116 84122 84119 84120 84123 84121 84115 84114 84118 84123 84123 84122 84119 84116 8411...

output:

10584639
21337504
21673977
22094555
22515162
23019871
23524597
24029304
24533998
25122797
25711620
26300465
26889283
27478113
28066949
28655764
29244606
29917525
30590466
31263437
31936350
32609254
33282221
33955176
34628128
35301052
35974005
36646959
37319898
37992825
38665757
39338740
40011682
407...

result:

ok 2000 numbers

Test #104:

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

input:

2000
6775 83978 41686 12955 2973 80921 74497 1084 88074 1317 86123 9215 97292 61767 66210 46791 39585 11229 87240 3035 59162 5960 53837 44708 83003 18408 63318 49643 71545 86338 74777 63263 39130 22202 15102 47821 77592 84024 19711 99430 65406 73575 71144 67196 87752 785 62007 49764 69031 76964 2905...

output:

6775
181506
96922
298169
147527
307225
347955
268736
650034
269435
608853
31980
208134
597420
180390
528519
391371
187989
319863
282892
872462
220071
370264
445248
621570
443370
501078
387980
405680
548681
648432
174496
126230
189787
775938
802650
735687
727473
334644
635467
329773
651681
790412
589...

result:

ok 2000 numbers

Test #105:

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

input:

2000
8528128 33318 33315 33317 33311 33309 33309 33314 33308 33318 33317 33311 33311 33311 33311 33316 33316 33310 33312 33317 33317 33316 33317 33309 33315 33317 33311 33318 33311 33311 33309 33312 33312 33313 33310 33312 33314 33309 33311 33309 33314 33308 33309 33312 33315 33315 33312 33313 33312...

output:

8528128
17122892
17256155
17422738
17589300
17789156
17989018
18188903
18388761
18621969
18855176
19088359
19321536
19554719
19787901
20021114
20254328
20520806
20787300
21053824
21320348
21586866
21853396
22119876
22386396
22652931
22919425
23185966
23452461
23718954
23985435
24251936
24518438
2481...

result:

ok 2000 numbers

Test #106:

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

input:

2000
815646381 606971007 713331717 140560265 253017709 219261665 472834963 629371710 453878606 580535971 841999598 964625152 599524270 228994295 978006086 996028092 580652957 252907797 454166172 414302337 646733598 66047093 229571075 42805953 809804900 745814290 106311136 444315792 854520853 8947900...

output:

815646381
2845234776
3057956196
3873886578
4530341040
4109990778
6674698601
6813752289
6144766867
7087595334
10447147808
8239862877
5250778593
6753407859
8268349019
10570010700
9663107885
2137108356
9283647530
5014194924
7286188215
7932319677
8155611573
9334630162
7050832550
8303867844
11991283336
1...

result:

ok 2000 numbers

Test #107:

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

input:

2000
507900 991 991 991 991 989 989 989 997 993 987 997 997 992 997 994 992 997 989 987 989 995 997 995 990 995 996 997 995 990 991 989 993 987 991 991 995 988 996 991 992 996 995 995 990 996 995 990 995 994 989 997 992 988 995 997 994 990 988 992 996 992 996 997 987 993 995 991 996 994 989 993 990 ...

output:

507900
1017782
1021746
1026701
1031656
1037592
1043528
1049464
1055440
1062383
1069298
1076263
1083230
1090178
1097152
1104113
1111062
1119022
1126936
1134834
1142748
1150700
1158666
1166622
1174547
1182505
1190470
1198443
1206405
1214332
1222266
1230186
1238134
1247019
1255934
1264849
1273794
12826...

result:

ok 2000 numbers

Test #108:

score: 0
Accepted
time: 1028ms
memory: 134768kb

input:

4000
999999997 7373061 7373059 7373052 7373059 7373060 7373054 7373053 7373061 7373057 7373059 7373056 7373058 7373053 7373052 7373054 7373055 7373060 7373060 7373061 7373058 7373053 7373055 7373056 7373057 7373055 7373059 7373059 7373060 7373060 7373061 7373057 7373053 7373056 7373053 7373057 73730...

output:

999999997
2014746116
2044238354
2081103621
2117968918
2162207269
2206445599
2250683923
2294922289
2346533681
2398145087
2449756482
2501367887
2552979266
2604590636
2656202021
2707813412
2766797877
2825782344
2884766819
2943751278
3002735707
3061720148
3120704598
3179689055
3238673498
3297657971
3356...

result:

ok 4000 numbers

Test #109:

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

input:

4000
3 5 4 5 4 2 2 2 1 5 4 3 5 1 3 2 3 4 3 5 5 3 2 3 4 1 4 2 5 2 2 2 2 1 3 1 4 4 2 2 1 3 2 1 4 5 4 2 2 2 4 1 5 3 1 1 3 1 5 3 5 2 4 4 3 2 5 5 1 4 5 2 5 1 2 3 5 4 5 2 5 5 1 4 1 4 2 2 5 5 1 2 3 1 3 3 4 2 2 1 2 4 4 2 2 1 1 1 1 5 5 5 5 2 4 5 4 4 3 3 4 5 4 3 1 2 4 5 1 5 1 4 2 3 2 2 3 3 3 2 5 3 3 2 5 5 2 2...

output:

3
16
32
16
32
42
42
10
24
63
83
30
51
24
36
52
99
32
49
124
55
56
52
45
39
36
48
95
42
76
60
42
72
56
45
47
48
48
52
45
39
30
42
64
32
75
32
84
39
42
60
29
79
68
56
44
49
56
63
52
150
52
23
103
92
56
150
150
134
39
86
56
107
62
54
78
115
64
91
103
128
51
107
88
137
128
56
142
95
111
64
90
64
149
52
...

result:

ok 4000 numbers

Test #110:

score: 0
Accepted
time: 625ms
memory: 134732kb

input:

4000
76545232 100383 100380 100384 100386 100380 100389 100387 100386 100387 100389 100381 100384 100386 100389 100385 100385 100384 100383 100381 100386 100380 100384 100390 100382 100384 100381 100385 100387 100381 100381 100381 100390 100390 100384 100389 100386 100384 100385 100380 100381 100386...

output:

76545232
153291230
153692753
154194668
154696596
155298879
155901201
156503522
157105839
157808537
158511248
159213923
159916611
160619314
161322034
162024733
162727430
163530497
164333560
165136610
165939692
166742738
167545809
168348920
169151984
169955055
170758112
171561190
172364287
173167341
1...

result:

ok 4000 numbers

Test #111:

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

input:

4000
2 1 5 10 3 10 8 3 1 7 6 10 2 3 9 4 8 6 7 2 10 8 3 10 5 8 6 9 10 5 6 4 9 4 7 7 7 8 5 6 2 1 6 2 1 5 3 1 7 4 9 7 9 5 6 8 4 2 4 1 7 2 10 8 9 9 8 5 5 3 4 6 5 1 7 9 1 3 7 6 4 8 3 7 10 7 9 9 2 3 8 4 9 2 8 9 5 9 8 2 1 5 2 1 3 9 9 9 2 3 7 9 2 1 6 8 3 3 8 4 4 5 5 3 1 9 8 1 3 2 5 3 3 8 7 7 4 7 4 2 3 4 3 6...

output:

2
6
19
29
48
81
75
15
10
41
21
76
33
57
39
17
70
66
99
24
50
48
27
64
75
89
74
32
52
114
54
68
141
38
59
69
44
75
14
33
33
123
80
72
84
139
33
90
83
17
105
83
113
89
112
149
63
36
78
33
177
126
100
60
127
62
108
63
102
10
38
55
136
145
134
182
90
86
95
74
98
216
237
169
107
147
54
109
156
191
230
12...

result:

ok 4000 numbers

Test #112:

score: 0
Accepted
time: 642ms
memory: 134956kb

input:

4000
85000705 166019 166013 166013 166020 166018 166012 166013 166020 166014 166013 166012 166018 166016 166022 166020 166021 166013 166013 166021 166017 166020 166014 166012 166012 166022 166017 166020 166018 166020 166014 166012 166020 166017 166013 166020 166013 166021 166012 166020 166014 166014...

output:

85000705
170333448
170997506
171827571
172657670
173653768
174649846
175645931
176642050
177804145
178966236
180128321
181290443
182452559
183614707
184776848
185938994
187267097
188595200
189923352
191251480
192579632
193907750
195235850
196563954
197892124
199220264
200548421
201876569
203204728
2...

result:

ok 4000 numbers

Test #113:

score: 0
Accepted
time: 4ms
memory: 134960kb

input:

4000
53 39 41 21 71 65 91 25 82 31 57 35 32 71 85 11 31 70 82 5 99 87 33 81 60 29 44 34 94 43 19 85 66 11 37 37 48 41 42 7 48 99 8 5 63 72 44 100 13 86 15 94 90 90 74 98 59 92 60 42 83 54 21 25 100 8 63 4 1 26 6 63 27 34 81 1 90 65 4 55 34 87 37 27 32 9 57 42 57 84 10 99 11 65 41 8 61 73 70 66 61 71...

output:

53
184
188
292
549
236
464
413
440
615
396
627
618
920
810
694
860
547
1268
463
1016
881
172
709
976
553
433
719
1392
684
521
1078
1391
706
1184
412
1096
1621
1122
1697
1337
1249
932
1506
1213
1638
648
1123
1576
965
1336
1821
893
792
555
550
797
1074
886
859
765
1355
683
642
753
653
1101
1007
794
79...

result:

ok 4000 numbers

Test #114:

score: 0
Accepted
time: 642ms
memory: 134700kb

input:

4000
999999998 21864573 21864573 21864574 21864577 21864582 21864582 21864580 21864575 21864573 21864578 21864573 21864574 21864574 21864579 21864581 21864579 21864579 21864581 21864574 21864580 21864575 21864572 21864582 21864572 21864576 21864580 21864576 21864574 21864572 21864575 21864573 218645...

output:

999999998
2043729142
2131187434
2240510302
2349833184
2481020658
2612208137
2743395619
2874583076
3027635087
3180687125
3333739141
3486791158
3639843180
3792895234
3945947302
4098999358
4273915978
4448832611
4623749203
4798665834
4973582436
5148499015
5323415661
5498332247
5673248855
5848165494
6023...

result:

ok 4000 numbers

Test #115:

score: 0
Accepted
time: 8ms
memory: 132848kb

input:

4000
36 56 739 860 103 34 344 478 821 7 389 949 446 945 650 764 391 440 21 634 178 289 913 785 570 32 283 666 963 959 575 833 518 972 223 974 938 407 684 922 580 664 298 870 551 381 488 343 84 473 965 388 835 654 4 885 168 612 40 358 182 182 936 897 750 284 323 303 401 251 213 847 633 294 328 5 204 ...

output:

36
184
1754
1996
482
140
1365
1232
4227
606
1586
4846
3069
3692
1372
2336
992
1688
1446
3598
2050
2636
5128
3498
3725
741
2470
6293
3854
8665
1222
6431
3984
10180
2504
3401
7083
3974
3545
9890
2962
11616
3143
7112
3432
12590
8728
1363
3005
3894
4878
5396
16311
3638
9636
6977
5552
3401
4495
8198
1154...

result:

ok 4000 numbers

Test #116:

score: 0
Accepted
time: 628ms
memory: 132656kb

input:

4000
1581568 3085 3091 3090 3090 3086 3090 3091 3093 3088 3087 3086 3093 3092 3092 3090 3090 3089 3093 3094 3093 3089 3085 3091 3094 3089 3087 3093 3093 3086 3088 3087 3088 3094 3090 3088 3088 3092 3087 3093 3094 3089 3088 3088 3090 3085 3091 3087 3088 3086 3088 3089 3093 3092 3093 3087 3085 3085 30...

output:

1581568
3169306
3181664
3197110
3212560
3231080
3249616
3268160
3286716
3308332
3329942
3351546
3373191
3394832
3416476
3438108
3459740
3484447
3509181
3533921
3558658
3583372
3608056
3632783
3657529
3682246
3706945
3731687
3756430
3781125
3805834
3830537
3855247
3883078
3910882
3938672
3966463
3994...

result:

ok 4000 numbers

Test #117:

score: 0
Accepted
time: 10ms
memory: 134676kb

input:

4000
65488 14002 25649 11250 63366 95816 98236 15761 92517 18066 53892 61513 4968 42686 37040 42969 47724 9614 96804 40371 79474 9490 80298 87993 1018 88879 52012 38209 43464 56090 65462 27186 55586 13757 18680 55236 95311 49425 50722 73187 52473 2242 5926 88332 64075 87534 26457 58446 35476 29093 5...

output:

65488
158980
249929
153476
363080
421846
790872
212009
489542
293218
499971
1073647
573735
367078
449415
301889
1326056
1173616
617956
835873
661211
349244
880117
600334
176036
1155745
670939
1287996
645295
457850
485966
647017
1466968
729598
229022
893803
692885
663178
490461
801620
561230
1194440
...

result:

ok 4000 numbers

Test #118:

score: 0
Accepted
time: 640ms
memory: 135004kb

input:

4000
37782022 73796 73793 73794 73792 73796 73789 73792 73788 73793 73795 73789 73795 73794 73789 73791 73798 73790 73794 73796 73797 73790 73795 73796 73790 73791 73798 73795 73790 73798 73790 73790 73798 73793 73798 73795 73798 73792 73791 73791 73792 73797 73792 73795 73797 73791 73791 73789 7379...

output:

37782022
75711636
76006811
76375780
76744744
77187514
77630255
78073008
78515744
79032289
79548846
80065375
80581936
81098495
81615023
82131564
82648148
83238468
83828812
84419170
85009536
85599860
86190215
86780577
87370903
87961233
88551610
89141973
89732298
90322680
90913008
91503334
92093718
927...

result:

ok 4000 numbers

Test #119:

score: 0
Accepted
time: 3ms
memory: 134760kb

input:

4000
301497640 408569302 47692111 456382999 163908744 464567830 805082510 808688459 899130023 759788268 352964170 972338776 626019291 689982633 949897874 235226476 92638329 593345133 348545940 106773163 498060058 286390378 865564898 457692776 177893593 594970151 448515760 163769193 971611538 1523539...

output:

301497640
1420133884
1971779519
1515761278
2675106606
3059336486
3740365846
2220372198
4071901963
4249115108
4582796826
7200192850
10050589499
4976739669
7155311046
5251127784
5306314312
6788938775
6880538020
816541606
3725658688
11822170302
2955942205
6344110314
5079129135
3320141128
4227589817
621...

result:

ok 4000 numbers

Test #120:

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

input:

4000
9454076 18461 18462 18466 18466 18461 18465 18460 18466 18467 18468 18460 18469 18461 18466 18461 18465 18465 18469 18470 18469 18469 18460 18461 18467 18462 18467 18468 18465 18461 18464 18462 18460 18463 18466 18466 18462 18468 18461 18470 18469 18460 18467 18470 18468 18469 18462 18465 18463...

output:

9454076
18945074
19018921
19111242
19203572
19314339
19425125
19535891
19646687
19775945
19905210
20034437
20163710
20292945
20422204
20551439
20680696
20828409
20976148
21123894
21271635
21419376
21567064
21714751
21862485
22010186
22157922
22305665
22453389
22601083
22748800
22896503
23044193
2321...

result:

ok 4000 numbers

Extra Test:

score: 0
Extra Test Passed