QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294466#4830. Transfer of Dutyucup-team1631#AC ✓56ms3564kbC++201.2kb2023-12-30 13:56:542023-12-30 13:56:54

Judging History

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

  • [2023-12-30 13:56:54]
  • 评测
  • 测评结果:AC
  • 用时:56ms
  • 内存:3564kb
  • [2023-12-30 13:56:54]
  • 提交

answer

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

#define all(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)

ll RN=40;
vll A(RN,0),B(RN,1),C(RN,0);
ll F(ll x,ll k){
    return x*x*A[k]+x*B[k]+C[k];
}

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    srand(4129164);
    

    rep(i,RN-1){
        A[i+1]=rand()%(ll(1e5));
        B[i+1]=rand()%(ll(1e5));
        C[i+1]=rand()%(ll(1e5));
    }

    string S;
    cin>>S;

    vll X(RN,0);
    if(S=="resume"){
        rep(k,40){
            cin>>X[k];
        }
    }
    ll N;
    cin>>N;
    rep(i,N){
        ll a;
        cin>>a;
        rep(k,40){
            ll f=F(a,k);
            X[k]^=f;
        }
        bool Z=1,P=1;
        rep(k,40){
            if(X[k]!=0)Z=0;
            if(F(X[0],k)!=X[k])P=0;
        }
        if(Z){
            cout<<0<<endl;
        }
        else if(P){
            cout<<X[0]<<endl;
        }
        else{
            cout<<-1<<endl;
        }
    }

    if(S=="start"){
        rep(k,40){
            cout<<X[k]<<" ";
        }
        cout<<endl;
    }



}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

start
5
10
14
10
12
10

output:

10
-1
14
-1
-1
8 572972 4151934 555085 3308372 23004595 1419923 22548871 102973 7381523 21499297 3590741 449257 10984004 5691772 12442947 3766887 24369698 6064776 5427590 170066 24323002 4135227 21093759 5398168 9210292 846770 5366381 6836638 12728207 589981 930622 24375247 1975358 8928344 12513361 ...

input:

resume
8 572972 4151934 555085 3308372 23004595 1419923 22548871 102973 7381523 21499297 3590741 449257 10984004 5691772 12442947 3766887 24369698 6064776 5427590 170066 24323002 4135227 21093759 5398168 9210292 846770 5366381 6836638 12728207 589981 930622 24375247 1975358 8928344 12513361 457340 3...

output:

-1
-1
-1
277
0
12

result:

ok 

Test #2:

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

input:

start
1
1

output:

1
1 193420 134451 134202 110456 141949 57313 105829 62464 189881 259665 193208 92522 169366 80471 136054 206519 268778 77749 155217 185052 239217 180735 158610 223010 142001 55829 123269 183301 159129 89235 57508 222779 186793 165516 69401 40400 201235 57736 54129 

input:

resume
1 193420 134451 134202 110456 141949 57313 105829 62464 189881 259665 193208 92522 169366 80471 136054 206519 268778 77749 155217 185052 239217 180735 158610 223010 142001 55829 123269 183301 159129 89235 57508 222779 186793 165516 69401 40400 201235 57736 54129 
1
1

output:

0

result:

ok 

Test #3:

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

input:

start
1
1000000

output:

1000000
1000000 66940071748054732 77225051004006222 13722040547079933 66044032424011988 93827033415014707 14010025396017907 93956001338010535 15309034070013085 52289079389058203 83980087652088033 62483070944059781 33568048169010785 39790078244051332 19723060640000108 48063054468033523 62770084830058...

input:

resume
1000000 66940071748054732 77225051004006222 13722040547079933 66044032424011988 93827033415014707 14010025396017907 93956001338010535 15309034070013085 52289079389058203 83980087652088033 62483070944059781 33568048169010785 39790078244051332 19723060640000108 48063054468033523 627700848300589...

output:

-1
1

result:

ok 

Test #4:

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

input:

start
2
1
1

output:

1
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

input:

resume
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
2
1000000
1000000

output:

1000000
0

result:

ok 

Test #5:

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

input:

start
3
1
2
3

output:

1
-1
-1
0 565308 612522 373377 927684 684371 156859 617783 66793 1038043 1716721 568121 277797 972892 477280 955127 593951 2047534 488292 1036658 59946 1780390 585527 722583 579688 968892 22718 839953 1034386 561127 193941 160182 1595423 1019986 861468 331317 10800 641213 426807 152384 

input:

resume
0 565308 612522 373377 927684 684371 156859 617783 66793 1038043 1716721 568121 277797 972892 477280 955127 593951 2047534 488292 1036658 59946 1780390 585527 722583 579688 968892 22718 839953 1034386 561127 193941 160182 1595423 1019986 861468 331317 10800 641213 426807 152384 
2
4
5

output:

-1
-1

result:

ok 

Test #6:

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

input:

start
5
483440
800458
959493
679027
187008

output:

483440
-1
-1
-1
-1
881740 4771113449094316 28246374905084226 13360201402280933 8048475208888644 87968286274352679 13187981104107995 88641388613734319 1275744900779241 46355551400748671 102390013181847169 4536812846463809 2440321862664681 53025846213049500 26523128909136872 44174972483183375 63858878...

input:

resume
881740 4771113449094316 28246374905084226 13360201402280933 8048475208888644 87968286274352679 13187981104107995 88641388613734319 1275744900779241 46355551400748671 102390013181847169 4536812846463809 2440321862664681 53025846213049500 26523128909136872 44174972483183375 6385887868523015 821...

output:

-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 

Test #7:

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

input:

start
68
901287
581649
963302
839936
728540
414441
916931
567596
695928
364562
839701
726560
34000
85414
129234
413159
976576
799600
479209
808330
182632
685443
41419
207533
762418
206283
144088
679114
945142
919478
220106
992468
483248
197576
129732
123083
987094
712824
650777
907335
206313
958433
...

output:

901287
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
112458 71966221627803160 75686560354710024 12121011917459354 37854141306715056 8136695496133...

input:

resume
112458 71966221627803160 75686560354710024 12121011917459354 37854141306715056 81366954961330622 4640110395288840 89348515058276732 8440376597088620 35947717601516146 11762022596012872 39779073025944560 34957510939897062 56352917186507880 29142806752286384 58598512761367896 39234894743112244 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 

Test #8:

score: 100
Accepted
time: 2ms
memory: 3560kb

input:

start
520
569396
440938
116732
473751
47601
877390
277114
259139
437475
193896
992342
402838
838349
33699
536576
163847
117713
927965
598864
939506
517156
87428
943725
624835
515205
108250
468405
990560
512040
343417
101050
944099
177534
73824
476709
772630
489775
929453
216227
822538
552185
208923
...

output:

569396
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
53183 22017130388028920 82685211088148361 15940624840729053 36580686303564684 55048313477205844 3267017030862962 60066609295644726 15658852361639429 48569364602317164 65096447355613304 30375763308569193 21922841820282965 54510038093796642 31529210653951151 7948542529274257 32484234469247380 9...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #9:

score: 100
Accepted
time: 3ms
memory: 3512kb

input:

start
8443
729060
666260
185101
382196
371654
40175
191745
696848
627288
695514
463530
357409
465277
741772
43361
979762
952428
178423
841409
405526
498821
973165
335585
375002
113423
365239
404592
237309
573524
962229
36036
696295
373438
251803
891072
633659
62534
157262
573215
610136
499209
762268...

output:

729060
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
400754 16135539439106100 40666465460306222 3227414633914167 20471160039366532 33050499644661005 5757566901271627 142846609548563707 12290124301262825 25417452540269145 67820472250331657 68118254622363213 16520054175718007 50203481710788124 18867258570937972 49936029926762483 3012519037674131 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #10:

score: 100
Accepted
time: 36ms
memory: 3548kb

input:

start
95751
308697
772166
788484
646333
666534
92445
786509
646923
836713
476019
699260
122853
518658
556909
839126
518374
192398
728985
64716
176986
975947
644795
748557
310350
187984
204486
401437
532833
615053
995384
580446
107265
183547
188255
578145
852736
311107
298993
513464
829086
302554
710...

output:

308697
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
3869 28368981531944732 29573450709430707 5199988253873502 58287471821874776 55085015795142505 7330330145513969 99890157095494845 5461557185895240 2009900688011269 104999220158454081 64586751825383352 29239934739569054 36890562429253510 5384431125971511 52286017742062806 47976331350141199 1092...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #11:

score: 100
Accepted
time: 48ms
memory: 3496kb

input:

start
99888
2
1
2
1
2
1
1
2
2
2
2
2
2
1
1
2
1
1
1
1
2
2
1
2
1
2
2
1
1
2
1
2
2
1
2
1
2
2
1
2
2
2
1
2
1
2
2
2
2
2
1
2
2
1
2
1
2
2
1
2
2
2
2
1
1
2
1
2
1
2
1
2
1
2
1
1
1
1
1
1
2
1
1
2
1
1
2
2
1
1
2
1
2
2
1
2
2
1
2
1
1
1
2
2
2
1
1
1
1
1
2
1
2
1
2
1
2
1
2
2
2
2
2
1
2
1
1
1
2
1
2
1
1
2
1
2
2
1
2
2
1
1
1
1
...

output:

2
-1
1
0
2
-1
2
0
2
0
2
0
2
-1
2
0
1
0
1
0
2
0
1
-1
2
0
2
-1
2
0
1
-1
1
0
2
-1
1
-1
2
0
2
0
1
-1
2
0
2
0
2
0
1
-1
1
0
2
-1
1
-1
2
0
2
0
2
-1
2
0
1
-1
2
0
1
-1
2
0
1
0
1
0
1
0
2
-1
2
0
1
0
2
0
1
0
2
-1
1
-1
2
0
2
-1
1
0
1
0
2
0
2
-1
2
-1
2
-1
1
0
2
-1
1
0
2
-1
1
-1
1
-1
1
0
2
-1
2
-1
1
0
2
-1
2
0
1
-...

input:

resume
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
99926
1
2
1
2
1
2
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
1
2
2
1
1
1
1
2
2
2
1
1
1
1
2
1
2
1
2
1
1
2
1
1
1
1
2
1
1
2
2
2
2
1
1
1
1
2
2
2
1
1
1
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
1
1
2
1
2
2
1
1
2
2
2
2
1
1
2
2
2
1
2
...

output:

1
-1
2
0
1
-1
2
-1
1
-1
1
-1
1
-1
1
0
2
0
2
0
2
-1
1
-1
2
0
2
-1
2
-1
2
0
2
0
1
0
1
0
2
-1
1
0
2
-1
2
0
1
0
1
0
2
-1
2
0
2
0
2
-1
2
-1
2
0
2
0
1
0
1
-1
2
0
2
0
2
0
2
0
2
0
1
-1
2
0
1
-1
2
-1
1
0
2
0
1
0
2
0
2
0
1
0
2
0
2
-1
1
0
1
-1
1
0
1
-1
1
0
2
0
2
-1
2
0
1
0
2
-1
1
-1
1
-1
2
0
1
0
1
0
2
0
2
0
2
...

result:

ok 

Test #12:

score: 100
Accepted
time: 31ms
memory: 3516kb

input:

start
99918
2
2
1
3
1
3
1
3
3
3
1
2
2
1
3
3
3
1
3
3
2
2
1
1
2
3
3
3
3
3
1
1
2
3
3
1
3
2
3
3
1
1
2
1
2
1
2
1
3
2
1
2
2
3
2
3
1
3
1
3
3
3
1
2
1
3
2
2
1
2
3
1
3
1
2
3
3
1
3
3
2
1
3
3
3
1
1
1
2
3
2
2
3
3
1
2
3
2
2
2
3
3
3
2
2
1
3
2
3
1
3
2
2
3
2
2
1
3
3
2
3
3
2
2
3
3
2
2
3
2
2
2
1
3
3
1
3
3
2
2
3
1
3
1
...

output:

2
0
1
-1
3
0
1
-1
1
-1
3
-1
3
-1
1
-1
1
0
3
0
2
0
1
0
2
-1
2
-1
2
-1
-1
-1
3
0
3
-1
1
-1
-1
-1
2
-1
1
0
2
-1
1
0
3
-1
-1
-1
-1
-1
1
-1
3
0
1
-1
1
-1
3
-1
-1
-1
1
-1
2
0
3
-1
1
0
2
-1
2
-1
-1
-1
1
0
3
0
3
-1
3
-1
-1
-1
1
-1
-1
-1
2
0
3
-1
3
-1
2
-1
2
0
2
-1
-1
-1
1
0
3
-1
3
0
2
0
1
-1
1
-1
-1
-1
1
-1...

input:

resume
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
99905
2
3
3
1
2
2
2
2
1
1
1
3
2
1
1
2
1
3
2
2
2
2
1
1
3
1
2
1
1
1
1
1
2
3
2
3
1
3
1
2
3
3
2
3
1
2
3
2
2
3
2
3
2
1
3
1
1
2
3
2
1
3
1
1
3
1
2
3
2
2
2
2
3
1
2
1
2
2
2
1
3
1
2
2
2
2
1
2
1
3
3
3
1
3
2
2
2
3
1
3
2
3
3
...

output:

2
-1
2
-1
1
-1
1
-1
2
-1
2
-1
3
-1
3
-1
-1
-1
1
-1
1
-1
2
-1
-1
-1
3
-1
3
-1
3
-1
-1
-1
1
-1
3
0
1
-1
-1
-1
1
-1
3
-1
2
0
2
-1
3
0
2
-1
-1
-1
-1
-1
1
-1
2
-1
-1
-1
2
-1
1
-1
-1
-1
-1
-1
1
0
2
-1
1
-1
1
0
3
-1
-1
-1
-1
-1
3
-1
-1
-1
-1
-1
2
-1
3
-1
3
0
1
-1
-1
-1
-1
-1
3
-1
2
-1
2
0
1
0
2
-1
2
0
1
-1...

result:

ok 

Test #13:

score: 100
Accepted
time: 31ms
memory: 3560kb

input:

start
99903
1
2
4
2
5
4
2
3
1
1
2
2
1
5
4
1
5
1
4
2
5
2
3
2
3
1
4
5
1
2
1
5
3
2
1
1
3
1
5
1
2
5
3
1
2
4
3
1
1
3
1
2
3
4
1
4
4
2
1
2
2
2
1
1
1
4
2
1
4
1
2
5
3
3
5
1
1
2
2
1
4
2
1
1
2
2
5
4
5
4
3
4
1
4
4
2
1
1
4
4
2
2
1
5
2
3
3
2
1
4
1
2
5
2
2
5
5
4
4
1
1
2
4
2
2
3
4
5
5
1
4
5
5
3
1
3
5
4
5
4
2
5
4
2
...

output:

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

input:

resume
3 871140 3220319 904244 828568 3752915 218881 3595081 822184 924419 3803113 832036 1591096 2044422 502811 1936106 878539 3810412 968489 986399 421246 4171823 816749 3830040 585190 865803 30135 863195 887469 3355169 446503 213700 3702091 1629357 905946 1712959 28918 852589 899376 208829 
99996...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
4
0
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
2
-1
2
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
5
-1
-1
-1
-1
-1
5
-1
-1
-1
-1
-1
5
-1
2
-1
3
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
0
4
-1
-1
-1
1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
...

result:

ok 

Test #14:

score: 100
Accepted
time: 44ms
memory: 3492kb

input:

start
99947
7
3
4
8
10
6
10
5
3
6
2
3
10
6
5
2
8
8
8
7
10
4
2
5
8
10
9
4
9
10
5
4
10
8
4
3
8
10
10
6
8
1
3
1
7
10
5
10
3
6
2
4
3
2
2
4
1
5
6
6
5
9
7
10
6
8
10
6
8
2
5
2
5
2
9
1
9
8
9
8
2
4
2
4
7
5
6
9
8
10
5
4
5
6
9
2
10
3
6
3
4
4
5
9
7
1
9
3
7
3
9
2
2
5
10
1
8
8
8
2
4
2
9
5
9
2
9
6
8
10
8
3
7
3
2
6...

output:

7
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

input:

resume
10 7317412 7581298 1895275 7103540 486605 1834707 344171 1831765 1220265 1410425 7308537 3580803 1367316 91424 2050943 7289291 4056300 1023460 1214672 1034192 4057020 7186305 892853 6990012 645518 12296 1191963 1134582 7511991 947385 1593150 4137407 3763418 747910 1961455 795842 7277075 33486...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
8
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 

Test #15:

score: 100
Accepted
time: 44ms
memory: 3552kb

input:

start
99880
1
11
7
14
7
9
7
4
4
8
9
6
8
12
3
11
4
14
1
12
12
11
9
10
6
3
12
8
8
11
7
11
1
11
11
14
4
8
1
14
14
4
3
7
13
3
3
8
6
14
12
3
14
8
14
3
5
7
6
6
7
2
11
13
1
10
2
6
4
11
3
1
7
10
14
14
5
8
3
14
2
6
4
3
9
3
11
5
4
11
7
5
5
7
2
5
14
5
7
11
11
10
11
2
6
11
5
12
11
10
13
8
12
4
9
9
12
6
10
7
6
1...

output:

1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

input:

resume
10 15342584 10459552 3285882 13110672 22658966 2952376 21989644 3812580 16699274 21304424 13604760 5641894 11825400 6453064 3179456 13192532 7176626 1771704 15242306 2838938 6960610 14452550 21665002 9833412 1922314 891198 13880522 15300060 9701632 1304284 3208600 7073600 7094672 371586 41066...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #16:

score: 100
Accepted
time: 43ms
memory: 3560kb

input:

start
100000
394129
918049
227627
394129
227627
918049
730034
886281
958919
958919
730034
886281
108051
279991
756917
982336
982336
756917
620015
643225
671990
498572
965213
784067
302045
302045
448973
284292
498572
549214
671990
643225
646142
108051
598249
784067
315666
448973
695438
965213
620015
...

output:

394129
-1
-1
-1
918049
0
730034
-1
-1
-1
886281
0
108051
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
279991
0
149638
-1
149638
0
953158
-1
546431
-1
-1
-1
273407
-1
-1
-1
273407
0
555339
0
654326
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

input:

resume
41310 7216110145864584 69875971240438096 3249746398687454 7404892259343920 1681593556494658 2975726272865928 1468372069537652 4137005838070188 6657267365661166 9281181020939256 7285320762911464 3544650181422490 28117990174737512 13686799198753560 638278363334064 7837793902836460 3328856968371...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
523142
-1
82886
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
647066
-1
254973
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #17:

score: 100
Accepted
time: 47ms
memory: 3516kb

input:

start
99999
947665
127760
350354
669358
625042
583671
697219
193704
575165
512223
530130
575165
858585
999857
546323
127760
391941
697219
706174
947665
187941
698085
583671
544095
462885
530130
544095
706174
318321
669358
999857
421347
512223
858585
350354
49865
187941
755625
546323
625042
698085
19...

output:

947665
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
391941
0
660927
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

input:

resume
347142 16537542223673572 22445642148205326 14303226285021131 70627637489749220 37661395806186585 4822148341178171 40433337868601283 9943681944318705 62701739776527965 143202973063137081 66036278511915005 12573475550815395 47064859652988908 8654255983784196 5430574952538259 67283554522690075 2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #18:

score: 100
Accepted
time: 24ms
memory: 3496kb

input:

start
99998
698147
885494
939196
838083
473356
306889
214611
177418
69534
569835
240345
400481
974284
780442
934650
284543
207419
603638
865861
553694
157688
99733
426984
23109
869388
214611
753442
762603
835849
511435
347206
300567
82280
377545
249724
300567
698147
503359
627471
481084
428245
76199...

output:

698147
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
373687 30656995801425336 54923473114937401 9648780545284381 28042303484732044 142637330600257468 12456961730580626 136366934635056358 17823127615307237 8718378648857540 108858957708428536 6159028842613897 15541372775560309 38627196956053794 15870599396679311 21895098031088449 8745733926060404...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
714625
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

result:

ok 

Test #19:

score: 100
Accepted
time: 31ms
memory: 3476kb

input:

start
100000
30233
30233
955328
685299
955328
685299
44198
44198
522253
957054
966960
397858
859956
924705
282166
522253
324522
428464
678972
517929
707311
859956
661351
607572
678972
878203
705428
404580
661351
337730
878203
592906
592906
923695
970896
397858
404580
165775
970896
924705
428464
3377...

output:

30233
0
955328
-1
685299
0
44198
0
522253
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
282166
0
14114
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

input:

resume
872862 66928209522640504 76875823937440900 16779031666625738 32557885640975840 107907937909827242 8689275505885248 76451386588292116 7930703938463336 70545280661740942 9692001022237320 30275081798264516 31875443907716606 3302982927062352 3059621969024036 1702877004069156 43819365295529284 605...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #20:

score: 100
Accepted
time: 40ms
memory: 3552kb

input:

start
100000
98488
113660
714787
629521
117767
260864
370889
996355
766032
216715
661826
948790
617570
848804
9497
133396
588336
642217
1330
120896
200351
475165
875409
314921
552870
352408
338059
484874
753986
620675
324236
695081
606442
585964
793839
62471
22716
249771
69430
778919
257915
46547
24...

output:

98488
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

input:

resume
796017 53910984063018864 61186344839826681 10446957854890059 53079501334973116 89462164230657950 11203946517288410 89335387663929202 12040011231095657 41291912251122770 66194180760182368 59224001688276897 27016396663168159 31438529650461386 13635798488968663 37599597091885601 5938029209983495...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
516489
0
259558
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

result:

ok 

Test #21:

score: 100
Accepted
time: 43ms
memory: 3452kb

input:

start
99999
252139
517628
929379
211409
510098
517612
484533
935749
142646
41367
256080
823962
855625
964251
622391
660610
102441
373506
348772
348772
318256
602600
971236
825004
831594
470525
484007
185377
218309
660739
735193
396090
823962
386689
97544
513091
893709
521497
873463
198979
256080
779...

output:

252139
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
418077 4943492468691868 74018845359428043 3200354906961406 32795829327692472 109407351317110873 2597448781067425 135780750149658877 5143717292813328 14153810916855085 130787492999952033 58746092861542128 2579622611453110 17939143049449334 32153926017833615 49432414231928798 47401336052000815 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #22:

score: 100
Accepted
time: 23ms
memory: 3556kb

input:

start
100000
455926
750995
903051
613182
272842
819322
696493
136047
109685
114924
936265
904562
371782
194824
528665
100293
793353
170884
526584
784120
521168
990077
97818
751453
645850
584429
849862
193302
288827
625990
714516
853829
137414
358898
416940
836017
759498
670799
68101
235115
849042
57...

output:

455926
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
247156 35313821215476112 127173088053089208 15583976636580092 35775903679362048 90299412491145956 6797352822825760 94500808795151768 7864694700295392 43569808580641644 91848818130721360 6766390178995192 34562260973574732 19240115166974400 12427361894509832 26832652804116040 51262407697567304 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #23:

score: 100
Accepted
time: 32ms
memory: 3448kb

input:

start
100000
68266
624214
484353
269449
135510
602966
160020
34440
747457
616904
466802
591950
250598
744721
131281
785497
718880
672530
363731
594834
629037
782441
263843
759653
749201
654978
38658
163113
558805
579678
851296
885087
929839
465855
288762
886784
763218
556089
611850
594356
403622
624...

output:

68266
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

input:

resume
512416 55936937091096304 114120558767408940 3483640711590108 24728105049435440 94034373505205680 17670651686806264 118790800235162448 14390283330119164 26734298976533576 5768597026020272 65465796080610596 3118670494163852 47399808721483656 16861595259976420 36185794400753788 24744055549766552...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #24:

score: 100
Accepted
time: 56ms
memory: 3488kb

input:

start
100000
325371
170814
366440
69006
768403
259070
95913
809395
717491
3516
171552
169354
993652
613598
528572
849870
814963
672358
250859
645459
462575
428387
237669
910936
290192
916701
839396
350711
206593
788590
793368
483334
961522
855487
430945
676893
48211
573064
500907
833337
911806
651
4...

output:

325371
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
843946 40524579821272024 60332888171240312 4749909783167322 6922631434165104 17591308809704814 10194492317833192 9623318428989788 16738502901824956 32832092674345602 115839280082844488 51840415013883520 23880195635369062 13456373354179656 34731104430299424 62145928242046152 67458987293618420 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #25:

score: 100
Accepted
time: 32ms
memory: 3456kb

input:

start
99999
115395
94587
538403
897723
564885
606177
598848
838949
10553
356321
446534
689926
89721
165139
986352
566786
736962
394383
337693
283650
541411
488121
398551
553188
799828
716527
341970
917677
568548
558178
636848
171256
83673
963298
455804
588947
998689
505360
453841
861469
409912
21262...

output:

115395
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
167658 2070108348941076 4733718252902 16586327178719319 57554076704465124 61559316102091821 6363226884130747 76846851022610619 5108753535708337 29953882998423065 45893279628248553 6772380990795029 26934278810963063 64551242227678700 182119966325628 52080755814556523 15979183951955955 86528168...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #26:

score: 100
Accepted
time: 24ms
memory: 3452kb

input:

start
99999
740054
956304
461015
924214
462434
228874
636986
21542
782461
900662
831645
477486
988863
949718
832513
290161
172179
686552
377378
754566
622358
460022
970789
826249
565455
350667
216175
599497
710009
738054
176661
218163
996206
403505
939995
156167
957831
568227
607100
899173
196775
78...

output:

740054
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
433828 14697199160515740 81954200001495182 2701766881921393 43151805476866356 78904649076750359 10044294180636931 7827867438313215 6224043400008869 49779164468077167 27982004289996049 9664605189743765 11805538959495493 53089525244820916 5516526078833948 51814453932527219 47838153665874383 107...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #27:

score: 100
Accepted
time: 36ms
memory: 3452kb

input:

start
100000
858735
826365
690220
831531
68461
834868
554047
528612
588949
76263
340817
719752
932561
743539
209520
259228
332553
646708
301885
669256
711791
981652
237362
556448
208225
692992
386198
313482
654512
814491
655660
774128
48827
860713
801796
226661
256777
656470
92208
221150
336852
6319...

output:

858735
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
326756 56387700550332576 79080183602557260 3359130168712696 61232303449378128 16050074691244732 16503062895777512 12627624931369848 12305726930688036 10105680922276796 54410369617217952 60762264721966484 23190400526081448 70141750177775096 12572473180602324 70246955952457212 33814604299377088...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #28:

score: 100
Accepted
time: 43ms
memory: 3484kb

input:

start
99998
263809
656132
304695
50279
431416
323316
323316
656132
431416
50279
263809
304695
304695
263809
656132
323316
431416
50279
431416
50279
304695
656132
323316
263809
431416
656132
304695
263809
323316
50279
263809
656132
304695
431416
50279
323316
431416
263809
656132
323316
50279
304695
6...

output:

263809
-1
-1
-1
-1
-1
-1
-1
-1
-1
304695
0
304695
-1
-1
-1
-1
-1
-1
-1
-1
-1
263809
0
431416
-1
-1
-1
-1
-1
-1
-1
-1
-1
323316
0
431416
-1
-1
-1
-1
-1
-1
-1
-1
-1
263809
0
656132
-1
-1
-1
-1
-1
-1
-1
-1
-1
431416
0
50279
-1
-1
-1
-1
-1
-1
-1
-1
-1
431416
0
50279
-1
-1
-1
-1
-1
-1
-1
-1
-1
304695
0
3...

input:

resume
168889 17115402028375584 9016348618028957 2944896707074783 16888225917994476 11602587963772998 2873330433466418 11570644429245106 2769064195567917 13086961508403658 9926486153779344 10733627134662909 8583347448212467 5517275097591410 2791433224663419 5671113615824357 10700757779943040 2472252...

output:

-1
-1
-1
-1
-1
-1
-1
-1
323316
0
656132
-1
-1
-1
-1
-1
-1
-1
-1
-1
323316
0
656132
-1
-1
-1
-1
-1
-1
-1
-1
-1
323316
0
263809
-1
-1
-1
-1
-1
-1
-1
-1
-1
50279
0
656132
-1
-1
-1
-1
-1
-1
-1
-1
-1
431416
0
50279
-1
-1
-1
-1
-1
-1
-1
-1
-1
656132
0
656132
-1
-1
-1
-1
-1
-1
-1
-1
-1
50279
0
263809
-1
-1...

result:

ok 

Test #29:

score: 100
Accepted
time: 47ms
memory: 3552kb

input:

start
99994
184887
688384
193819
505562
189883
483143
970039
388819
912196
956913
780681
241879
180122
916737
791635
708502
215748
111177
16744
740722
740064
923629
892917
423861
508246
475150
165530
226634
105622
971462
386915
720921
434050
846759
126666
797120
800748
264722
438736
117966
134264
16...

output:

184887
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
198335 24045308656670808 133565821757919417 17866700117385317 1958092430460108 41576005626155924 16463973944740786 30575464284031702 16654652457670613 6125937367179740 136826632879270744 38636673550937129 11542595117817693 62401056601499586 32912815712837839 41908448590031873 3857042471227178...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #30:

score: 100
Accepted
time: 48ms
memory: 3556kb

input:

start
99994
887768
264610
623037
691748
602754
988689
455828
746853
662421
329105
748973
845208
494232
72284
192969
902257
907740
53069
177587
726710
418391
169032
534002
574237
235404
613939
987294
125245
303240
123352
376298
239894
841761
99706
672895
863515
637062
75914
139277
660239
453946
54127...

output:

887768
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
247698 11693483782932872 3213290266573884 4057706238365238 15154405386431520 133149989924880366 1289352903514016 132427362361895500 7432221096518552 24115658271352922 133348968585155096 27801872090263676 6518383620384810 3802366909369136 275205189435596 61242235478407852 28747636528432268 130...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #31:

score: 100
Accepted
time: 28ms
memory: 3520kb

input:

start
100000
333404
37472
654393
182613
37992
624401
939999
390509
244589
488059
832375
61105
599684
682654
163207
438686
735976
70996
708822
983562
993868
539328
60518
872175
256075
87909
345970
2001
531669
395758
95562
857148
554644
842459
463542
565647
3624
465257
413702
878812
750533
163187
9177...

output:

333404
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
253690 45276393626087864 77484740811902656 214678446713210 65547350097039888 109132851855184950 8912324671033336 115302254597014316 9820891444603300 41946887099416170 24397040487325800 24785407548399832 19213263684790902 63836800713695736 18998524063782408 26168935027406208 16408252659792788 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #32:

score: 100
Accepted
time: 35ms
memory: 3556kb

input:

start
99994
543640
489661
255858
433176
485629
197129
896121
714696
850723
144356
441813
203899
988142
395063
108777
404610
383288
686938
266867
88727
244946
279082
176046
710195
454942
121666
375579
616524
658810
44932
181311
104265
376840
734895
315411
497722
17930
592987
460951
683604
959149
7297...

output:

543640
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
267694 20787547517486040 130057619990410100 2822823650218114 64301194055849888 85087283758829658 13447813354371776 84122511464518164 11767194809763832 71344885858083214 61375377865283560 2075141647744004 17653434147475334 14885877870899888 21723243482863844 37089822710527668 49900492078367636...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #33:

score: 100
Accepted
time: 52ms
memory: 3560kb

input:

start
99997
203369
312464
965080
272620
857569
126210
872488
865360
343744
255970
628893
529958
183758
875970
968303
886887
707666
403277
155956
203767
867258
34634
406479
786830
37142
9703
928812
908876
995005
755987
261836
889989
364047
289822
945970
740232
283515
402826
729689
561160
839374
28565...

output:

203369
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
16429 43731804981035452 39588647328317179 17333026891623550 42192231459575800 18647663798057009 2768981306641281 99604072094729229 3585411371011936 17453162038750781 81050560388427041 24551045881760240 23425322981041182 28123213662373206 11903883776165583 33545081852517518 53739503960285135 4...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #34:

score: 100
Accepted
time: 40ms
memory: 3504kb

input:

start
99994
410936
979326
575242
131985
477352
603362
997571
171355
199505
495481
9106
561542
921563
129261
732521
462428
66391
253973
796050
217349
491183
376961
312110
350575
86541
703158
479513
735393
51922
456189
414761
527327
48902
320098
934749
679641
293061
12041
931624
184532
796684
86442
32...

output:

410936
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
727189 68723549131657600 93510972928826089 3578795917644751 71377469603095836 115860474198780666 1439901896761322 115741470680350986 8130275106249153 57422495757821494 51757046903592176 64282920636297009 134148898009571 62243487102053914 18999412136500839 18512164618866897 53707412775748784 8...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #35:

score: 100
Accepted
time: 43ms
memory: 3560kb

input:

start
99996
727783
607261
63171
949130
980500
75229
158615
865538
119761
176088
204882
714637
430224
222381
463704
184888
348275
657155
656198
115016
130510
731187
382346
434069
490276
227990
582032
428931
675009
99543
213047
301800
906141
524470
181017
453251
179509
954878
801375
155687
618057
8570...

output:

727783
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
624656 60321398230328336 50441520807212444 12945330340151164 10078103118065136 94348509804197576 395219289058456 134191043524521888 1137635667600940 41676381859875368 44339691872874992 64272237350981796 12259197815143348 68534772216138984 8182034542884004 14059278636085644 36756244989770712 9...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #36:

score: 100
Accepted
time: 40ms
memory: 3520kb

input:

start
99998
933646
554173
345184
994611
715473
773844
869293
139690
96317
463511
210032
452622
30569
909927
105568
65163
695673
664610
667940
18196
335039
652358
588430
492921
563679
411104
656046
420733
297728
156796
379853
722687
89377
258027
914390
677848
933937
320455
64261
376868
673512
499678
...

output:

933646
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
113419 6227258329796904 88276582202489225 15343317541774073 65024102170177388 81369603582505864 10069195156114786 93776972116210334 9304932959294653 68673564183749288 69013267041346920 28735292960342457 28646842743641537 66649615355174418 19978689439627103 25135820814179953 59755659736377708 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #37:

score: 100
Accepted
time: 44ms
memory: 3496kb

input:

start
99998
247014
809683
821712
428536
187592
828719
372441
802500
727197
359106
969931
405871
793313
52426
818102
855891
996929
487006
426796
371857
809874
761594
961867
960127
83849
486273
834951
163411
924892
179364
675318
937658
752103
584916
984593
234471
372333
259137
624815
148053
534867
135...

output:

247014
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
655629 60553588748114752 136352893132779401 673751111103727 56130804157404636 144066500528627186 16488865417680170 126277743681538458 8315614943428945 2183862000416174 12371431521572720 11021508170160737 29692012979649523 2675835998789114 3750066616810327 24592063530962769 5388370951607920 23...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #38:

score: 100
Accepted
time: 16ms
memory: 3516kb

input:

start
100000
262630
97175
890863
510401
724579
565188
662361
89982
771540
946389
240257
46313
992883
364353
775560
7589
149261
948261
291095
316386
706040
57805
790307
681253
921626
406994
471478
577440
297778
544127
429733
770856
650650
4335
858801
593767
618773
560456
135732
55787
110471
384878
11...

output:

262630
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
560989 36262555689617856 50794153680265001 7443439766636431 36420579871562844 57459819045823250 7652150586422698 57471666962806138 11095246198590417 28374999327512734 47008644824965040 42882981914256161 18201742292737619 23863451951091194 12087808283866327 34944188143855345 43306657791593776 ...

output:

306163
0
528599

result:

ok 

Test #39:

score: 100
Accepted
time: 27ms
memory: 3440kb

input:

start
5
555978
725868
980889
315278
208665

output:

555978
-1
-1
-1
-1
688040 57956407286836140 131465446955263742 17625247524886701 58408642116393556 119260442086523923 16994969998988819 118919888005663943 17739132726837117 67643367558299443 130411522632888609 70445352125379413 28812957202226505 63579735020261572 33727976128148092 62738080949658051 ...

input:

resume
688040 57956407286836140 131465446955263742 17625247524886701 58408642116393556 119260442086523923 16994969998988819 118919888005663943 17739132726837117 67643367558299443 130411522632888609 70445352125379413 28812957202226505 63579735020261572 33727976128148092 62738080949658051 699481145844...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #40:

score: 100
Accepted
time: 52ms
memory: 3456kb

input:

start
12345
525838
676167
632315
183052
98180
154876
355933
658192
431587
928002
327393
544008
609168
431218
962386
577470
1926
883046
853842
974147
762473
246092
393316
35079
440174
197789
858592
164639
942994
676886
488627
303821
611690
963062
680182
464178
687587
125138
650353
609079
974664
86773...

output:

525838
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
989396 34994611617267276 72286727975777970 2312801475301013 63334079817347908 3377819839209607 7428805095268603 8910605070128367 15567998725639593 1894604806159639 19149028837491073 17828872438189297 33642561846509937 11634655104618012 16642650581314872 16550914152124575 70746063910996327 430...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #41:

score: 100
Accepted
time: 36ms
memory: 3564kb

input:

start
100000
900001
900002
900003
900004
900005
900006
900007
900008
900009
900010
900011
900012
900013
900014
900015
900016
900017
900018
900019
900020
900021
900022
900023
900024
900025
900026
900027
900028
900029
900030
900031
900032
900033
900034
900035
900036
900037
900038
900039
900040
900041
...

output:

900001
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
195040 16527633066448128 139647236195387456 4407793477405184 11044179713985024 25391318430876064 8669007344152704 10626131110173888 908290845698688 8914403984731232 15301204558862336 31543803428129024 7276602252771648 276898845729280 1415539625921792 13912631720890432 7403845757387520 1126448...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #42:

score: 100
Accepted
time: 32ms
memory: 3520kb

input:

start
100000
900001
900002
900003
900004
900005
900006
900007
900008
900009
900010
900011
900012
900013
900014
900015
900016
900017
900018
900019
900020
900021
900022
900023
900024
900025
900026
900027
900028
900029
900030
900031
900032
900033
900034
900035
900036
900037
900038
900039
900040
900041
...

output:

900001
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
195040 16527633066448128 139647236195387456 4407793477405184 11044179713985024 25391318430876064 8669007344152704 10626131110173888 908290845698688 8914403984731232 15301204558862336 31543803428129024 7276602252771648 276898845729280 1415539625921792 13912631720890432 7403845757387520 1126448...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok