QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#633186#9225. Fibonacci FusionMu_SilkTL 3945ms437996kbC++201.6kb2024-10-12 14:43:342024-10-12 14:43:35

Judging History

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

  • [2024-10-12 14:43:35]
  • 评测
  • 测评结果:TL
  • 用时:3945ms
  • 内存:437996kb
  • [2024-10-12 14:43:34]
  • 提交

answer

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

const int N=200010;
const int N1=10000010;
const ll M1=1e9+7;
const ll M2=1e9+9;
pair<ll,ll> fib[N1];
string s[200010];

ll add(ll a,ll b,ll M){
    ll t=a+b;
    return t>=M?t-M:t;
}

ll sub(ll a,ll b,ll M){
    ll t=a-b;
    return t<0?t+M:t;
}

void init(){
    fib[0]={0,0};
    fib[1]={1,1};
    for(int i=2;i<N1;i++){
        fib[i].first=add(fib[i-1].first,fib[i-2].first,M1);
        fib[i].second=add(fib[i-1].second,fib[i-2].second,M2);
    }
}

int lenfib(int n){
    return n*log10((1+sqrt(5))/2)-log10(sqrt(5));
}

void solve(){
    init();
    int n;cin>>n;
    for(int i=0;i<n;i++)cin>>s[i];
    sort(s,s+n,[&](const string& a,const string& b){
        return a.size()<b.size();
    });
    map<pair<ll,ll>,int> mp;
    ll ans=0;
    for(int i=0;i<n;i++){
        int len=s[i].size();
        int l=0,r=N1-1;
        while(r>=l){
            int m=(l+r)>>1;
            if(lenfib(m)>=len)r=m-1;
            else l=m+1;
        }
        pair<ll,ll> pi={0,0};
        for(auto c:s[i]){
            pi.first=(pi.first*10+c-'0')%M1;
            pi.second=(pi.second*10+c-'0')%M2;
        }
        for(int i=max(0,l-10);i<min(l+10,N1);i++){
            pair<ll,ll> tmp=pi;
            tmp.first=sub(fib[i].first,tmp.first,M1);
            tmp.second=sub(fib[i].second,tmp.second,M2);
            ans+=mp[tmp];
        }
        mp[pi]+=1;
    }
    cout<<ans<<"\n";
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n=1;
    // cin>>n;
    while(n--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 166008kb

input:

6
50
8
8
5
72
354224848179261915070

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Accepted
time: 44ms
memory: 171028kb

input:

28
200878223506436882933619847964496455022155117513398820563747455993172799881403389571477889821109288771413214004090719097929400406252135763028179112130390003528046316900603668569910008417315162907579003880220844686222148696041857432602133894827753998572080650383305777912447151917272483538029469449...

output:

27

result:

ok 1 number(s): "27"

Test #3:

score: 0
Accepted
time: 72ms
memory: 176460kb

input:

5187
2640352926124261912741724778991366987330659389621881876017670644497364093930668042530271338851702874394631009332660937266680740235862107353443518003194307853104942996827176097428402408674756368623972812842571069642405111849826172879369776309763468485788964245903781380419155348915131587410703749...

output:

6073

result:

ok 1 number(s): "6073"

Test #4:

score: 0
Accepted
time: 64ms
memory: 166120kb

input:

200000
2
2
2
2
1
2
1
1
2
2
1
1
1
2
2
1
1
2
1
1
2
2
1
2
2
2
1
1
1
1
2
2
1
2
1
2
1
1
2
2
1
1
1
2
1
1
2
1
2
2
2
2
1
2
2
1
1
1
2
1
1
1
1
1
2
1
2
2
1
1
1
2
2
2
1
1
2
1
1
2
1
2
1
1
1
2
2
2
1
1
1
1
2
1
2
1
1
2
2
1
1
2
1
1
2
1
2
2
1
2
1
2
2
1
1
2
1
1
1
2
2
2
1
2
2
1
1
2
2
2
2
1
2
1
1
2
1
2
2
1
1
1
1
2
2
2
2...

output:

15003749259

result:

ok 1 number(s): "15003749259"

Test #5:

score: 0
Accepted
time: 3675ms
memory: 437944kb

input:

200000
944176313232170622314
2590599414036674999101
753315073608896000424
9299685298577430049245
9361800333778142620806
8988699166328904060999
9606920674025578304023
4203331868598952026136
5183047027116137697788
3968714342776915029801
8130984095583566992354
3206443643596048048798
6248561214283254355...

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 89ms
memory: 167444kb

input:

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

output:

4388485679

result:

ok 1 number(s): "4388485679"

Test #7:

score: 0
Accepted
time: 3945ms
memory: 437068kb

input:

200000
6828421000391895
1989111434563275
5896525738540342
7580233289915833
7220157112714422
6690072177484914
6664449707566084
8245839001391019
3008772159581769
8148007474169818
9400853099859484
6346860654847919
7403109176990407
2581313740335401
1273038733901266
9824983373567665
7206452987542085
7181...

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 3636ms
memory: 428716kb

input:

200000
163414517
35065810
104946881
686842158
509604537
114869915
194658958
55736013
211143419
526188788
18298540
311113507
727676120
517103071
25044427
38567543
386683792
246028194
750300322
4412101
865997254
674545866
775054146
977862574
699213474
347544102
740489922
632436817
297903184
435135324
...

output:

59

result:

ok 1 number(s): "59"

Test #9:

score: 0
Accepted
time: 29ms
memory: 173272kb

input:

2
2088564186870382794642016448725374479500907752342156600368614861600912666885211013490310624029649329209019866849808883315545780833167257516031795949145341911463438482795792374909577113387320732207052482556858037878075154734524317145645776084240387870219160545328462016106959746495953786767421892196...

output:

1

result:

ok 1 number(s): "1"

Test #10:

score: 0
Accepted
time: 68ms
memory: 166676kb

input:

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

output:

4400854684

result:

ok 1 number(s): "4400854684"

Test #11:

score: 0
Accepted
time: 3649ms
memory: 428864kb

input:

200000
3118333850638
35270102833223
62994441325054
21050207685515
79452732606523
43405025574846
14676822470608
40589739145551
72610266245240
95906978427970
59399311725881
80286412880911
98171197939601
15555757959003
68766133429050
11529744877477
36884730947747
93994258932707
21245575958503
287958909...

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 2742ms
memory: 416460kb

input:

200000
1218982
621720
5848120
1753415
5889366
1747270
7735728
8089704
4279399
7927020
9269797
1332511
6334797
8964092
9525679
7325470
1527918
893049
8483303
1134021
8872739
532622
8977450
4503590
6512507
4903981
4892296
6522908
9237430
2297267
8063244
1546378
5054973
8702942
4392067
7868582
2029729
...

output:

5695

result:

ok 1 number(s): "5695"

Test #13:

score: 0
Accepted
time: 28ms
memory: 173756kb

input:

2
2088564186870382794642016448725374479500907752342156600368614861600912666885211013490310624029649329209019866849808883315545780833167257516031795949145341911463438482795792374909577113387320732207052482556858037878075154734524317145645776084240387870219160545328462016106959746495953786767421892196...

output:

0

result:

ok 1 number(s): "0"

Test #14:

score: 0
Accepted
time: 43ms
memory: 171748kb

input:

7
1337338011484742791299410909385691591046809197321138600848517667449672944525104556519885455609314839827342014896149347803816156838828377155724440687227582622225528496005639283622580269360626125544811511998701746678193286138664078007880894120371020695543061391758951301196457121332483784041873539166...

output:

3

result:

ok 1 number(s): "3"

Test #15:

score: 0
Accepted
time: 41ms
memory: 172224kb

input:

274
36199225654659696764078634911736913237817300779619275513532816361663892134832409526194170532894366762053993742963156407869241123825595148459428450874407641181641292360313933002704706339921470798414371554709977458935038423965022899542511184991008496997550268720067992926078576871685757638601127765...

output:

273

result:

ok 1 number(s): "273"

Test #16:

score: 0
Accepted
time: 80ms
memory: 168788kb

input:

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

output:

4387062637

result:

ok 1 number(s): "4387062637"

Test #17:

score: 0
Accepted
time: 3829ms
memory: 437996kb

input:

200000
8244945625103564139
31587720380738895055
95764870267791202443
90342450187757930095
57990438361916446378
37041843791326956160
92044245094014254241
52147231507776742459
57440162490738372914
75951472709544205529
91095641579841704038
6354859395638708014
13171197741013485755
31875767906879519150
2...

output:

0

result:

ok 1 number(s): "0"

Test #18:

score: 0
Accepted
time: 22ms
memory: 166292kb

input:

10
6
8
6
6
7
6
3
3
2
6

output:

12

result:

ok 1 number(s): "12"

Test #19:

score: 0
Accepted
time: 49ms
memory: 174268kb

input:

2
2088564186870382794642016448725374479500907752342156600368614861600912666885211013490310624029649329209019866849808883315545780833167257516031795949145341911463438482795792374909577113387320732207052482556858037878075154734524317145645776084240387870219160545328462016106959746495953786767421892196...

output:

0

result:

ok 1 number(s): "0"

Test #20:

score: 0
Accepted
time: 3677ms
memory: 428848kb

input:

200000
51732486464
15203118134
55665354475
37097810807
44823788729
92577384010
20189320156
62707564695
81665154265
89603063623
48003727587
14457078372
37230540002
65288477498
52282695470
76070393338
26054936545
14171092817
61770329497
85319218123
57730830347
20295186479
9036398880
63607160628
825711...

output:

1

result:

ok 1 number(s): "1"

Test #21:

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

input:

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

output:

108128

result:

ok 1 number(s): "108128"

Test #22:

score: 0
Accepted
time: 2079ms
memory: 275496kb

input:

170297
36618903089511909212027904
295898671290484359833820549055
855922209609024693421257591054
104046893712788281969810034913
294974348216094859258128389147
898675289823399842963411259541
849917444544425201790051381287
554091687601993279655091754543
100543835187751461953816001432
324625661878684349...

output:

669637

result:

ok 1 number(s): "669637"

Test #23:

score: 0
Accepted
time: 28ms
memory: 171744kb

input:

9
1554055664340235444670436446744662342403532554270354440324316254234564540613440405260344004460144314614345467104554712624142524427154124266304046362254623626323466324132625200314136012323044624260020307414632254233433163613166424734133322715601644464634614352434441422431546266431240655123113002704...

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 16ms
memory: 166124kb

input:

30
173224810532175
17167616931584
361
605
17167680176960
956658780060
4052737359577
497497353099204
1548072001901
190392490708530
789347852872433
5
804010804445736
139520616464
43988911432793
4052739537276
514224
2178304
25273161431631
53314112869
17114366064696
20097096794
26821231255228
4944012745...

output:

29

result:

ok 1 number(s): "29"

Test #25:

score: 0
Accepted
time: 43ms
memory: 171156kb

input:

100
11549310117176145486225764017375125851223984720694884717797775426631366931455266419214045399503089615971818090352858567015012529938870819767662704737995190471260542479965705803468920094883954929878415301662741322840828368641397254767329039284292920968364857914289821588505056486091849012400101879...

output:

36

result:

ok 1 number(s): "36"

Test #26:

score: 0
Accepted
time: 1666ms
memory: 303940kb

input:

100223
94009034043768394308211497706411911232935573312371
90700235808140495519523074128684120917303691406421
72874906060637684247409916135076680433361225881761
80161826274205256086415063126094978143520789283159
98145703778166390989463238108464755254200147417281
70995217131009339533392756476859088949...

output:

0

result:

ok 1 number(s): "0"

Test #27:

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

input:

6
50
8
8
5
72
354224848179261915070

output:

4

result:

ok 1 number(s): "4"

Test #28:

score: 0
Accepted
time: 48ms
memory: 174616kb

input:

3161
7
14
130
1467
16244
105149
1241120
13689232
151890909
1684420994
10901848031
128682014414
1419326741506
15748353436059
101920677024935
1203048867903722
13269285156772499
147231358659594589
1632748057345119600
10567412357776757138
124734439986929988911
1375786096219966094366
15265241654400597567...

output:

3160

result:

ok 1 number(s): "3160"

Test #29:

score: 0
Accepted
time: 3684ms
memory: 428776kb

input:

200000
7930099016
7136448262
4599143849
4725192685
4685680672
739140078
7214691825
5031750793
4820916507
6017675339
485443032
2327198454
8808146518
7746012012
713572475
4706110510
3560774990
7482541413
8975601524
3896030632
3018545943
7048325939
2370597692
7867568189
6902951191
333917381
112842576
9...

output:

7

result:

ok 1 number(s): "7"

Test #30:

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

input:

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

output:

399686351

result:

ok 1 number(s): "399686351"

Test #31:

score: 0
Accepted
time: 16ms
memory: 166076kb

input:

20
11142320330634256153203413422244004724022423010341634226101444226235404243251
1510233372263004374041444256322353356243032432623343544033530634305504714430614564334410564323262245
3315442551434205740422347432544540327016564444656542244600440525402604662333366
53153452623340724302644316423336472713...

output:

0

result:

ok 1 number(s): "0"

Test #32:

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

input:

15
9227465
832040
701408733
2178309
267914296
433494437
165580141
1346269
5702887
3524578
102334155
24157817
14930352
63245986
39088169

output:

14

result:

ok 1 number(s): "14"

Test #33:

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

input:

10011
5327909559109070794570420158512927656597532686406620479564191583982981578330651724849734045529811497
9659152635523321620063357842120653540264735554377366787893904211734024058449827205523008852363337860
74727969709789190305111991663528709940303307406256850364862896747520682645094217166643105732...

output:

0

result:

ok 1 number(s): "0"

Test #34:

score: 0
Accepted
time: 82ms
memory: 178748kb

input:

10051
63063334260332707210045601560460743222655443603043556526226343270234640534370464564114515210165526527443654044521634373434642424304154632545440427364312534131536671541443033313334224226302334143144172200431314323334240461563243422303322351122343066463334623434
625665325411647124616714317265541...

output:

14

result:

ok 1 number(s): "14"

Test #35:

score: 0
Accepted
time: 3652ms
memory: 428508kb

input:

200000
3231427058997
5671035772108
505876205893
9869979702346
336233080766
4805367039084
270125613380
929924360332
6390838551951
1896341268898
3923051450784
397979630166
6527843499305
1937207519921
9355189911971
953387547771
5307619807657
6689006266290
517624961010
1532034993156
1921439567851
331239...

output:

0

result:

ok 1 number(s): "0"

Test #36:

score: 0
Accepted
time: 24ms
memory: 170844kb

input:

30
167491015938836604073444715975948275020752570351918554475806772549228015468626967999929915531115950274814727218152384400389926950026165552262394643249255747252904223055992443689134599380405599101636105379410012227917206510976118633243994494607279010051579617303878166798657109212106136099974387457...

output:

29

result:

ok 1 number(s): "29"

Test #37:

score: 0
Accepted
time: 1289ms
memory: 224136kb

input:

200000
31520
9835
67679
91981
37157
27950
36846
70635
13880
18818
52443
46788
38014
56271
48270
28452
36146
82523
60850
55346
16869
95814
89245
98640
40746
68625
53391
63023
4402
36521
95532
52344
24072
70060
11619
12227
98964
78211
95010
83216
22122
46697
31271
85556
57237
82689
92115
88247
9186
85...

output:

555586

result:

ok 1 number(s): "555586"

Test #38:

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

input:

2
7471143542670631923583760838674866685142093708045228091216520373087113961892117195149240140968159205634006625906479367372855893882103887377565868731323681755476477285090435798416695243644387513257156317699123267511524797133211810893688279220755514610253525742595752854587254548452737426517576583616...

output:

1

result:

ok 1 number(s): "1"

Test #39:

score: 0
Accepted
time: 40ms
memory: 166080kb

input:

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

output:

706251650

result:

ok 1 number(s): "706251650"

Test #40:

score: 0
Accepted
time: 71ms
memory: 167736kb

input:

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

output:

4417250451

result:

ok 1 number(s): "4417250451"

Test #41:

score: 0
Accepted
time: 789ms
memory: 227292kb

input:

84752
86009844223237105273313186367406421847273312848013100091343
340516459610995530579473198046278412250343444815876655725270
62236463822700922600990709332929319814536375509143833251557
5611500219672931601067284378715174151735452175901717138530
64201778346042476353565735947990316834224189505881
609...

output:

420579

result:

ok 1 number(s): "420579"

Test #42:

score: 0
Accepted
time: 3895ms
memory: 437968kb

input:

200000
7127173784651987052
4249291679502906721
9703708230592019478
4404701921242244700
2344941043578422215
3091914365064271594
9867051863259427168
9880844309023770200
7211977710785226267
1694381065563438860
201683809955321192
4085536489000602058
7553409623903962290
4033981640350364868
54455660173955...

output:

0

result:

ok 1 number(s): "0"

Test #43:

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

input:

200000
9
9
2
10
3
4
3
9
7
7
8
5
9
9
7
5
8
5
7
1
5
6
3
2
7
5
7
7
2
9
8
6
2
1
8
1
3
4
10
2
3
4
4
7
4
10
8
6
1
5
3
3
3
5
5
8
6
9
3
6
5
4
2
8
10
9
1
5
1
4
8
9
4
3
4
9
10
3
6
2
10
3
3
6
6
7
4
9
5
2
1
8
8
7
308061521170126
7
4
6
1
9
3
9
9
3
1
10
8
7
2
9
10
6
2
6
10
8
5
1
5
1
7
9
5
3
6
1
4
2
6
2
8
5
3
1
6
...

output:

4397248166

result:

ok 1 number(s): "4397248166"

Test #44:

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

input:

156
18459619692692557705784877669569448552986613407875981372394172107449477143544507182981317111359110933094916231296859516709399078435198069511763391151449973008095601542066128297192521457018669738382503324519683244087838172215626103362576668917140635977557324975206273718561053735845026938082217687...

output:

155

result:

ok 1 number(s): "155"

Test #45:

score: 0
Accepted
time: 77ms
memory: 169604kb

input:

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

output:

4407433502

result:

ok 1 number(s): "4407433502"

Test #46:

score: 0
Accepted
time: 568ms
memory: 217844kb

input:

51002
376123568879569384290612536925367837315702704676220875375604948366932308891841579226324979782110
28623980260058260408921525210046136035459718869538444006842678034295486291710095655185249062457587
21690449377523978494384257361181223226054780834691728496618681724478608654823982012150023238151530...

output:

81486

result:

ok 1 number(s): "81486"

Test #47:

score: -100
Time Limit Exceeded

input:

200000
478606336755874083
603529542039676573
240066379679942455
20635508638460497
945472883349378253
395868479387568634
865948317871000880
136079313625171264
764680881358360622
195117422398549932
143437863196805305
907507515211279442
723479709912499971
671617918537158715
439287855279754360
202716825...

output:


result: