QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179616#6106. Making NumberZhou_JKAC ✓152ms20508kbC++234.2kb2023-09-14 23:03:452023-09-14 23:03:46

Judging History

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

  • [2023-09-14 23:03:46]
  • 评测
  • 测评结果:AC
  • 用时:152ms
  • 内存:20508kb
  • [2023-09-14 23:03:45]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<array>
using namespace std;
const int N=100005;
int n,q;
int x[N],y[N];
int cntx[10],cntr[10];
int s[N][10];
struct Segment_Tree
{
    #define ls i*2
    #define rs i*2+1
    struct Node
    {
        int l,r;
        int len;
        array<int,10>cnt;
        friend Node operator+(const Node &a,const Node &b)
        {
            Node c;
            c.l=a.l,c.r=b.r;
            if(b.len==b.r-b.l+1) c.len=b.len+a.len;
            else c.len=b.len;
            for(int j=0;j<=9;j++)
                c.cnt[j]=a.cnt[j]+b.cnt[j];
            return c;
        }
    }tree[N<<2];
    void push_up(int i)
    {
        tree[i]=tree[ls]+tree[rs];
        return;
    }
    void build(int i,int l,int r)
    {
        tree[i].l=l,tree[i].r=r;
        if(l==r)
        {
            if(y[l-1]>=y[l]) tree[i].len=1;
            else tree[i].len=0;
            for(int j=0;j<=9;j++)
                tree[i].cnt[j]=0;
            tree[i].cnt[y[l]]++;
            return;
        }
        int mid=(l+r)/2;
        build(ls,l,mid);
        build(rs,mid+1,r);
        push_up(i);
        return;
    }
    int find_kth(int i,int c,int k)
    {
        if(k>tree[i].cnt[c]) return n+1;
        if(tree[i].l==tree[i].r) return tree[i].l;
        if(k<=tree[ls].cnt[c]) return find_kth(ls,c,k);
        else return find_kth(rs,c,k-tree[ls].cnt[c]);
    }
    void modify(int i,int u,int v)
    {
        if(tree[i].l==tree[i].r)
        {
            if(y[u-1]>=v) tree[i].len=1;
            else tree[i].len=0;
            tree[i].cnt[y[u]]--;
            tree[i].cnt[v]++;
            y[u]=v;
            return;
        }
        if(u<=tree[ls].r) modify(ls,u,v);
        else modify(rs,u,v);
        push_up(i);
        return;
    }
    Node query(int i,int l,int r)
    {
        if(l<=tree[i].l&&tree[i].r<=r) return tree[i];
        if(r<=tree[ls].r) return query(ls,l,r);
        else if(l>=tree[rs].l) return query(rs,l,r);
        else return query(ls,l,r)+query(rs,l,r);
    }
    #undef ls
    #undef rs 
}T;
bool check(int t)
{
    array<int,10> len{};
    if(1<=t-1) len=T.query(1,1,t-1).cnt;
    for(int j=y[t]+1;j<=9;j++)
    {
        if(cntx[j]-len[j]>0) return true;
    }
    return false;
}
int pos,t;
void calc()
{
    pos=n;
    for(int j=0;j<=9;j++)
        pos=min(pos,T.find_kth(1,j,cntx[j]+1)-1);
    if(pos==n) t=n+1;
    else
    {
        if(check(pos+1)) t=pos+1;
        else if(pos==0) t=0;
        else if(check(pos)) t=pos;
        else t=pos-1-T.query(1,1,pos).len;
    }
    array<int,10>sum{};
    if(1<=t-1) sum=T.query(1,1,t-1).cnt;
    for(int j=0;j<=9;j++)
        cntr[j]=cntx[j]-sum[j];
    return;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    string sx,sy;
    cin>>sx>>sy;
    n=sx.size();
    for(int i=1;i<=n;i++)
        x[i]=sx[i-1]-'0',y[i]=sy[i-1]-'0';
    y[0]=-1;
    for(int i=1;i<=n;i++)
        cntx[x[i]]++;
    T.build(1,1,n);
    calc();
    cin>>q;
    while(q--)
    {
        int op,i,x;
        cin>>op;
        if(op==1)
        {
            cin>>i>>x;
            T.modify(1,i,x);
            if(i+1<=n) T.modify(1,i+1,y[i+1]);
            calc();
        }
        else
        {
            cin>>i;
            if(i<t)
            {
                cout<<y[i]<<"\n";
                continue;
            }
            if(t==0)
            {
                cout<<-1<<"\n";
                continue;
            }
            int v=-1;
            for(int j=y[t]+1;j<=9;j++)
                if(cntr[j]>0)
                {
                    v=j;
                    break;
                }
            if(i==t)
            {
                cout<<v<<"\n";
                continue;
            }
            int sum=0;
            for(int j=0;j<=9;j++)
            {
                sum+=cntr[j];
                if(j==v) sum--;
                if(sum>=i-t)
                {
                    cout<<j<<"\n";
                    break;
                }
            }
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3304 1615
6
2 3
2 4
1 1 3
2 2
1 2 4
2 1

output:

3
4
0
3

result:

ok 4 number(s): "3 4 0 3"

Test #2:

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

input:

838046 780357
10
2 1
2 2
1 2 4
2 3
2 4
1 4 5
2 5
2 6
1 1 9
2 2

output:

8
0
3
4
6
8
-1

result:

ok 7 numbers

Test #3:

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

input:

2950 9052
4
2 1
2 2
2 3
2 4

output:

9
0
5
2

result:

ok 4 number(s): "9 0 5 2"

Test #4:

score: 0
Accepted
time: 83ms
memory: 17716kb

input:

677626993975892499704039030543272430899275243910257911804799779050091046516452988178013531014268918811173939650642586439566406179191340032290242471164620397693718115937469230865639050202204033086180013798392250945514997389392089836361472892923108709052296874567465127993121832785182254870655135620662...

output:

7
9
3
6
0
4
7
1
1
4
1
5
4
5
2
1
3
8
3
8
4
9
5
8
1
5
6
1
3
9
4
7
2
2
4
1
2
0
1
8
3
7
0
8
5
9
9
4
9
4
4
4
7
1
5
6
3
0
3
7
4
6
2
4
9
6
4
8
2
0
4
4
2
0
6
4
8
4
9
9
9
0
4
6
8
1
9
6
5
8
3
1
5
4
8
8
7
7
4
0
0
6
2
0
3
9
8
6
8
2
9
2
7
6
1
4
3
8
9
6
4
8
3
5
4
7
5
7
4
1
7
5
3
9
0
9
8
9
1
5
6
8
9
8
5
5
0
1
8
0
...

result:

ok 49975 numbers

Test #5:

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

input:

511480086753564282821528855178563929745572703769018450686519315364994143491916967272893579288334926852555836951575502077626800161580974941822438484334857675128558893510619871726746734393334541554012208506864881136634075294480149999489082362631943342210952658415428622030685123950393010171647050758706...

output:

6
2
8
5
5
4
6
0
4
4
7
6
0
7
4
5
2
2
4
3
9
5
3
5
9
7
3
4
4
7
6
6
1
8
8
9
5
3
4
8
8
5
2
1
1
9
9
4
6
6
3
5
0
3
5
9
5
1
6
4
2
3
0
0
2
4
2
0
1
0
4
4
6
0
7
7
2
4
6
8
3
4
8
7
8
7
8
3
2
1
6
0
5
7
6
0
1
7
4
8
3
3
0
6
8
2
7
0
8
4
5
3
5
5
5
2
2
6
8
1
2
0
4
7
6
9
5
1
7
5
4
8
7
5
7
9
6
7
2
4
4
1
8
3
6
6
7
4
9
1
...

result:

ok 49929 numbers

Test #6:

score: 0
Accepted
time: 78ms
memory: 19284kb

input:

472330038062685403802290048373688812241446646131931548371358882106958120983785742309604463056365028053384497842197902484437459388258909692021136121000437587309020081655554248416237604736980589208691771671180049141616984590478595217573559381574160795133081222146011610538801003982869672106413196666521...

output:

1
0
7
0
7
5
8
3
3
2
4
7
0
4
1
9
1
4
7
0
4
2
6
0
5
7
2
2
7
6
3
9
4
5
9
1
0
1
6
9
4
3
2
3
9
9
1
2
6
7
1
3
0
3
9
0
3
3
8
7
2
0
5
9
5
4
1
5
3
0
2
7
7
9
2
4
2
9
9
2
8
8
7
2
1
4
0
0
9
8
7
0
9
1
4
2
4
1
0
8
2
8
5
3
5
6
3
9
5
3
3
2
2
1
7
1
5
3
1
4
5
9
2
9
7
8
2
5
7
3
6
8
6
0
5
9
8
6
0
5
0
9
9
4
4
7
5
2
9
0
...

result:

ok 50042 numbers

Test #7:

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

input:

386233463881717072875581827146070520751747126770517661713166628789189627724980782503822688280432695205513144141020509128499902342551505341291338189246300115206785134828666443367135785829882467172883975489827563563779932862926264780289693656829908932995843695380306139371737193136677430867087011811629...

output:

3
4
1
9
4
5
6
9
2
7
5
6
6
3
1
3
4
1
1
8
9
8
4
9
2
6
5
8
6
2
6
5
2
0
9
2
6
2
5
1
0
7
4
0
0
8
6
3
2
1
1
8
7
0
8
2
9
7
4
7
8
0
4
4
4
1
6
2
3
5
2
5
7
4
7
5
2
8
5
6
7
9
8
3
4
6
6
5
4
6
6
2
6
3
9
8
8
9
1
1
8
0
3
5
8
1
9
2
8
8
3
7
6
8
3
3
7
1
8
7
6
4
4
3
5
1
9
7
0
8
7
4
7
5
2
1
3
3
9
4
0
1
4
7
9
8
2
8
2
1
...

result:

ok 49992 numbers

Test #8:

score: 0
Accepted
time: 84ms
memory: 20424kb

input:

745583415671483224856063268315723013208093546585338940411563348183242984213440969816633586058807593886948284456364509705729509729228715032842535706716746469625245322861513742352222229050932105542759840801595902514973411977932610802947368055541931365403552209659301957818972982202503192705179196359265...

output:

2
6
5
5
6
3
5
3
8
4
8
8
2
9
8
7
4
2
9
3
7
4
5
7
6
3
3
7
3
3
8
8
1
1
6
9
3
7
6
1
6
0
7
2
5
9
6
9
8
7
5
2
4
2
2
3
5
1
1
0
4
6
5
9
4
4
3
3
4
8
9
7
3
3
6
6
2
5
9
4
8
8
9
6
5
6
6
1
8
9
6
6
4
8
1
6
3
9
5
3
0
4
6
0
3
2
5
4
0
1
1
9
1
3
3
3
7
6
3
8
3
4
2
3
9
1
3
5
9
3
6
4
7
6
1
2
3
9
3
7
0
4
3
0
1
8
9
3
4
9
...

result:

ok 49998 numbers

Test #9:

score: 0
Accepted
time: 83ms
memory: 19252kb

input:

687148149898590835128734096020818522700529479354111091949312960135002085101685319911019178222572129521797945953853905713726059302432395983082137469982521105165791059980657901801789909933674074000321433370751326550034923277070556265051872985662112168660614913449190413055498618459115952038181012606241...

output:

8
9
1
3
3
5
6
1
9
6
8
7
8
4
4
1
0
8
7
4
5
3
1
9
6
1
7
1
3
5
0
9
2
9
8
9
1
9
3
6
5
7
5
0
4
8
2
7
4
5
0
5
8
4
1
4
4
0
2
2
2
8
6
8
2
4
8
7
4
8
1
4
4
9
9
0
8
2
2
9
6
7
8
8
2
7
3
5
6
0
0
8
1
6
3
3
8
9
9
7
7
8
5
0
1
9
8
0
3
7
8
3
6
9
3
1
6
8
8
6
8
6
4
2
7
1
4
4
7
8
8
5
7
5
0
2
6
6
9
5
6
4
9
9
0
8
1
0
1
7
...

result:

ok 49960 numbers

Test #10:

score: 0
Accepted
time: 87ms
memory: 20440kb

input:

511410590003206748743026837297269617156860999163734519503176440751003346982052198127800474000547281930526632644516345712652806992189907653673339456162173013088973643589761306561810879584560558973989908184836364781078674144968906782339481360394956565722773781126049434152414561245822910375917863114385...

output:

6
5
8
4
6
7
3
3
7
5
4
7
3
4
9
7
5
7
5
9
6
7
1
1
0
4
6
6
6
2
1
1
1
1
1
4
3
0
6
6
1
3
1
8
5
6
9
4
1
3
1
3
3
1
2
6
7
4
5
8
9
1
9
5
4
0
6
2
0
8
5
3
3
6
5
2
4
0
9
3
3
7
7
1
5
3
0
0
2
1
4
7
5
3
3
7
4
9
0
0
9
7
1
3
0
3
3
9
6
7
3
6
6
5
7
1
4
1
6
8
3
5
1
1
6
5
8
7
7
8
6
0
6
9
3
3
7
3
5
4
1
6
3
3
5
9
9
3
8
6
...

result:

ok 50026 numbers

Test #11:

score: 0
Accepted
time: 83ms
memory: 19692kb

input:

412360324827978957176583694828310104622570454802673606075377276215378423471812273240200693215211478171394399847108642814672419979452510744863417210894498320009435941598606905856781313771012596687811178858150589131279746416550676044440596239657711594345549954832445910296588861477458018692941905242921...

output:

1
8
5
2
3
9
2
8
3
8
4
3
6
5
4
1
3
1
3
5
5
8
9
2
6
1
6
4
0
6
6
3
5
6
3
4
8
3
9
0
4
0
2
4
7
5
4
3
3
6
9
9
3
2
6
9
4
9
8
7
5
4
7
7
1
0
3
2
7
7
3
8
7
4
8
3
9
9
1
1
3
6
3
4
3
6
4
5
5
7
2
2
4
6
3
3
7
3
0
8
7
9
6
8
8
3
5
0
5
9
4
3
1
2
5
4
2
7
1
8
9
8
3
5
1
0
9
4
2
4
2
3
3
1
3
4
8
4
6
3
6
9
8
0
1
1
9
5
5
3
...

result:

ok 49948 numbers

Test #12:

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

input:

856329357016035505153679499429017618522016754810690745637585353807331320998717013354091215483446306780029058518021052461209557195048736635002613733400864914984195578672150918541302093698958464131643763263426069118339541672648022567592260494469158830001260168605992533833064759869674003545017260491009...

output:

6
8
7
0
4
5
2
3
8
9
4
3
9
1
9
5
6
7
3
4
6
6
6
8
1
8
7
5
3
2
4
0
5
5
4
0
7
1
7
6
2
0
8
7
1
0
7
9
6
3
6
7
0
1
5
1
5
4
9
6
9
7
5
3
9
9
0
0
1
1
1
6
0
0
1
6
2
6
9
5
5
6
8
9
2
4
9
8
4
4
3
1
8
7
5
6
4
3
6
3
5
8
1
6
8
2
2
7
5
6
1
6
8
0
9
8
8
2
2
6
9
8
6
6
5
0
8
2
8
9
1
7
9
8
8
6
6
4
7
7
8
6
0
3
4
0
8
9
5
5
...

result:

ok 50026 numbers

Test #13:

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

input:

207978770069539728817271045945248746241818636280006621963858065263619645208863709951955581650441063780888002768150890864716529529107478452273845099423444295437542775021972720210956321827972662761649312268042113348860266380256320778223985862679633592673273717863417100156085087721855894555348405500719...

output:

0
2
8
1
3
4
5
2
7
1
3
4
7
4
2
8
7
8
8
6
1
3
2
5
4
1
2
8
3
1
9
7
6
1
1
1
6
2
9
9
1
2
5
8
6
0
3
9
3
5
3
5
1
5
9
9
1
7
9
6
1
0
3
8
7
5
3
1
6
2
5
7
6
0
6
6
4
1
5
8
9
9
2
3
3
0
5
5
4
6
8
9
4
6
4
2
6
5
1
6
2
9
5
7
8
1
3
3
7
4
1
6
4
9
7
8
2
9
7
4
7
1
4
7
7
9
1
1
8
6
5
2
3
7
6
7
5
9
1
5
1
4
6
8
0
7
1
6
5
2
...

result:

ok 50025 numbers

Test #14:

score: 0
Accepted
time: 74ms
memory: 20400kb

input:

164428742658650397298339420552443455101568119017687712665088396853574942791024688455356045424416501995017237219123098822376166101955464501466812812649086495459262962860410367705834209150622335631443903792735958848302687895202370035731150731351456335899336987100067685293569877313567752878310940738755...

output:

1
8
6
9
4
2
1
1
4
5
2
7
5
5
3
5
9
0
8
1
3
2
5
3
8
1
5
8
5
1
8
6
4
8
2
3
5
8
0
2
1
6
1
4
6
2
8
1
8
9
8
7
1
0
0
2
5
1
8
7
7
4
8
5
2
5
8
3
8
6
7
7
5
8
0
2
3
3
7
7
0
1
6
1
0
4
6
6
8
7
8
6
2
9
6
0
2
1
5
1
4
0
6
2
8
9
4
9
8
1
9
8
3
0
4
5
0
9
8
3
1
8
1
6
8
0
8
5
8
8
1
9
5
0
1
0
3
4
2
2
9
5
3
7
5
6
2
2
0
6
...

result:

ok 50022 numbers

Test #15:

score: 0
Accepted
time: 74ms
memory: 18384kb

input:

998767354558322906625620015167794944657818251826400836199407978416545069691547034108346073612303533094806958918805437473506719658260875212008010754739853345390768650837328322896341589343550573089739136161331978235561797773390415153085804136062697178719078131890066607436125156355189718122782466286459...

output:

8
7
1
8
6
9
3
0
3
8
4
4
7
4
8
6
5
6
3
6
8
9
2
0
3
6
6
5
1
5
9
0
4
2
4
4
9
8
7
3
5
4
5
6
7
5
2
5
3
9
2
3
8
0
1
9
8
2
2
7
5
6
9
4
1
7
2
3
5
8
7
6
5
1
8
7
9
6
5
6
8
3
0
2
3
8
1
6
9
0
0
2
2
6
5
5
2
9
4
5
2
6
3
0
4
3
6
5
1
9
6
1
6
2
0
9
2
0
0
0
2
1
7
1
9
4
6
4
5
3
5
7
3
7
0
6
9
0
0
9
6
3
3
6
0
8
1
7
5
0
...

result:

ok 49925 numbers

Test #16:

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

input:

496117747349030859242712439552847857173335411600183925191605438390308987026311211708747951426974071035231015263358833473203227234913873963653616567985338093815470280976485981645438455282050097953301422963637710015063600088898465670743373005589682945970747704429911563933261846140395176443170301349475...

output:

8
7
8
7
3
9
0
9
9
6
6
6
6
9
4
4
8
7
9
0
4
3
9
2
0
4
0
5
7
0
0
2
2
0
4
7
9
3
7
5
9
4
1
7
5
0
5
8
2
2
3
1
1
5
4
8
2
9
9
9
3
3
5
9
2
2
3
8
0
2
7
9
0
7
6
2
0
5
7
6
5
4
5
7
9
1
0
5
7
9
0
5
8
1
7
4
8
8
6
2
5
3
2
9
9
8
6
5
3
1
6
6
9
9
2
4
6
0
7
7
2
9
5
0
1
7
1
3
7
9
2
1
4
8
6
1
6
1
3
5
3
5
4
3
6
3
0
7
6
8
...

result:

ok 49966 numbers

Test #17:

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

input:

879077611568305029524273214759692546023681920619909666645816914982402484913116250093137152695049206643460741460271833570279670253121465212427814124175174303836095991951317860795539333476942195636187095271368531406226910990880535137299873821691406148014509516363900520071195534330828232780282826477512...

output:

4
2
2
0
5
4
0
1
4
5
7
2
2
5
2
3
1
7
9
0
6
0
3
0
4
4
0
6
7
5
8
2
3
3
9
6
3
6
0
5
2
1
8
1
0
9
1
7
0
9
8
4
8
2
8
0
0
9
5
1
7
4
5
4
8
9
3
1
9
0
0
2
0
7
6
8
6
0
6
1
2
9
1
1
7
1
4
7
7
6
8
9
8
6
6
2
3
8
9
4
0
4
8
8
5
6
5
8
0
8
5
2
4
4
0
1
1
1
4
3
1
4
1
6
2
0
7
7
3
1
6
7
9
5
9
2
1
4
5
8
2
8
9
8
0
4
4
6
1
5
...

result:

ok 49930 numbers

Test #18:

score: 0
Accepted
time: 76ms
memory: 18460kb

input:

203968624374417872599305057960984030372982060448780195288250350584273341499079030196956080469617724888838406395743230124996577835874461904028816041291105143917991579964524439244822473009488603180812160846042219893300437496918585071513942690378687371239260250594909446238312463866438654013074218583158...

output:

4
4
2
1
9
2
8
7
7
9
0
0
9
0
3
6
0
0
0
3
2
0
6
4
6
4
8
7
8
3
4
6
4
3
3
9
7
5
2
8
2
0
9
3
7
8
1
9
1
8
6
2
5
1
4
2
3
8
7
9
5
5
1
8
8
4
8
5
5
9
3
1
4
8
1
5
1
1
5
3
5
4
8
0
3
3
7
3
3
6
2
3
1
4
3
1
9
4
2
5
2
2
4
6
4
6
0
4
4
9
2
2
9
2
9
8
3
8
3
6
4
8
1
1
3
4
5
9
6
0
2
1
4
1
9
4
9
4
0
4
5
9
6
5
0
0
6
4
2
7
...

result:

ok 50003 numbers

Test #19:

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

input:

664828096591123841572296486591075547872856344115703231722069827322096608384090019204366008637182716083677163674626630101166122412141233257614793889487901853834607207647628854345933911980118782654448753250508439833562347861706645574261195579084500718799334623432092033351838757658540625351640733190174...

output:

9
3
8
3
6
7
6
2
3
9
2
5
7
1
9
2
1
3
2
1
9
1
2
2
7
7
2
1
3
4
7
9
4
6
3
2
9
5
1
0
2
6
7
5
0
0
3
4
3
2
6
4
9
0
2
0
6
1
0
0
5
8
7
2
6
6
2
7
2
8
6
0
8
1
9
9
4
0
9
9
9
3
9
1
6
0
1
9
7
1
3
1
7
8
5
4
3
1
2
7
0
3
5
1
7
9
9
3
0
7
6
4
2
3
5
4
4
6
4
0
3
8
5
0
0
0
6
6
8
9
0
1
9
3
7
9
7
4
7
6
6
9
2
2
6
6
4
8
8
7
...

result:

ok 49932 numbers

Test #20:

score: 0
Accepted
time: 76ms
memory: 20452kb

input:

538277005780206492547758127106338332942166863920626370354889467904857105765864853407146908051557283832086050965218002709762370809755260168800991848537318108412183410666511031136010687133126586128270827928749854284725338763494617082398663948307548401951295673167687759918452646683358081278618679228278...

output:

5
6
6
5
5
2
9
7
4
0
3
5
0
7
5
7
4
4
0
6
6
9
2
0
9
7
2
9
2
1
3
8
4
1
1
0
7
0
9
4
5
7
7
2
1
3
9
2
7
8
4
9
4
0
7
9
8
2
3
1
3
3
3
9
1
4
5
7
2
7
9
7
0
2
2
0
6
4
9
7
2
1
8
1
0
2
9
5
9
3
9
6
5
2
0
0
0
3
7
3
3
2
0
6
2
2
8
1
9
4
3
4
0
5
9
9
6
4
9
2
4
6
1
2
3
3
1
1
7
4
7
6
0
7
1
9
6
8
8
2
6
3
2
5
5
7
5
2
7
7
...

result:

ok 49986 numbers

Test #21:

score: 0
Accepted
time: 78ms
memory: 18104kb

input:

495771171510956215425849505877989041934463907749463401816284949317967102657725642519357521827220981533415719496177403212899877861008462319189997565717292012399843108955067492885127568226666094372172812133495292610825814638596763445052778805429795808678025887319040351695928846875889183001500514376014...

output:

0
0
7
6
0
2
6
8
5
1
3
4
2
7
1
5
6
4
8
2
7
7
4
9
1
4
0
5
1
1
0
9
7
3
0
2
2
2
7
3
2
0
5
7
1
4
7
4
6
8
7
3
2
8
5
9
5
5
6
8
3
7
8
4
1
2
4
7
3
6
0
2
1
6
1
8
2
9
5
0
7
7
3
7
0
6
9
2
1
3
2
2
8
9
6
1
8
4
2
5
1
5
8
8
9
7
0
2
8
0
7
9
1
3
9
0
3
0
2
2
1
2
4
2
4
1
0
7
9
4
0
9
1
3
3
5
4
7
2
4
0
4
0
5
5
1
7
4
5
9
...

result:

ok 49938 numbers

Test #22:

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

input:

339021186719668483838715376004230534434933258139082986584033309451762283542528687694537199091395539732284376157061909810459620048718678068779193113943885652210405795974721651379416846641514792856746325971179616451066361148304792963168282675194510047836786751096975236151504932023091965948552679823138...

output:

6
7
0
8
9
9
0
7
1
7
4
6
0
7
6
6
4
6
9
5
7
0
0
4
2
6
2
2
2
7
4
8
2
0
3
8
6
2
4
9
2
1
3
9
3
9
2
7
3
8
4
5
3
0
2
8
7
2
8
6
0
4
8
1
7
3
6
9
0
5
1
6
7
9
0
4
7
0
6
6
0
1
1
3
1
9
2
7
6
7
4
0
0
2
7
3
4
3
1
9
8
2
1
5
8
8
7
0
5
1
7
7
6
9
0
7
2
1
1
3
0
4
6
1
1
4
1
7
8
8
8
9
0
0
7
5
5
0
6
1
3
7
7
2
0
7
2
4
7
5
...

result:

ok 49981 numbers

Test #23:

score: 0
Accepted
time: 78ms
memory: 20424kb

input:

982785026525426716882042936180514667751283786386206050446143243960867407815359255008057908268651562142164706343879003037524226079930774131586056314459643132401529562979630028015745276169684869852727881008541171308112403521690763653373751520126387382411044586528624189483080092870501589527365878963787...

output:

9
0
5
9
5
3
9
4
8
5
5
0
7
8
0
8
2
4
9
7
5
1
7
8
7
2
1
9
6
0
1
1
7
7
3
9
8
3
7
5
3
3
4
0
3
3
5
5
1
2
4
2
3
7
6
2
7
5
9
9
6
5
7
9
1
4
5
9
2
5
4
2
5
8
8
9
9
6
4
9
5
2
9
9
5
2
0
2
1
7
2
6
7
1
0
1
5
9
0
2
3
9
4
9
3
1
7
9
5
6
5
1
5
3
0
3
2
1
0
4
8
2
2
8
2
0
6
3
9
7
7
8
9
6
6
2
4
5
5
0
8
4
2
1
5
0
8
8
6
9
...

result:

ok 49935 numbers

Test #24:

score: 0
Accepted
time: 73ms
memory: 20508kb

input:

443189678460132360813229383747775566201531260183924145814374873124718304625184044102407980436726530281103403600495012079144539296227791201748933585065829937525249850952548487400872752642176523326750976376213596833271856626381717111637261715449128129329793550291211001960166382428116169484337714797923...

output:

2
3
5
8
5
1
0
3
4
9
3
8
9
3
0
3
6
7
3
7
0
8
3
0
6
3
9
0
4
9
8
1
7
3
7
0
3
4
8
7
9
8
0
4
7
9
6
8
9
1
3
7
2
7
1
5
1
2
9
5
8
6
4
5
3
0
8
9
9
1
5
3
7
1
4
9
4
4
8
2
1
0
7
3
5
4
4
4
8
2
4
9
9
9
3
6
3
9
8
2
9
3
2
5
2
8
0
9
2
6
7
4
3
7
2
8
6
1
0
7
3
0
4
7
8
7
6
2
0
0
0
0
2
8
5
6
1
8
4
3
0
2
5
1
2
0
2
9
6
2
...

result:

ok 49925 numbers

Test #25:

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

input:

377878063054648573132795928952066251589852722198763685377798555912772465112969982319088416200394212086938168995388418666417588212990303556333139028105492643416261499977209596160279434433012015610306105181975416278435366998383873238763930635351946516940594922091276462427730172694022021737709235844047...

output:

2
5
6
8
6
6
8
6
9
6
3
8
6
0
9
0
1
0
0
8
3
9
9
4
0
5
5
4
1
4
2
0
6
1
0
3
0
6
2
3
8
2
3
8
5
1
1
8
6
9
3
5
4
3
2
3
9
2
6
2
4
7
2
6
4
0
1
8
6
0
4
9
4
5
1
0
7
8
4
1
7
5
0
1
8
3
5
3
3
7
2
5
4
0
7
1
4
7
7
1
0
7
6
5
0
2
9
3
8
0
9
0
3
4
9
0
0
8
6
7
2
4
0
5
2
8
7
1
6
1
8
8
6
6
6
4
2
8
1
6
0
7
2
9
9
8
1
1
1
0
...

result:

ok 49983 numbers

Test #26:

score: 0
Accepted
time: 78ms
memory: 19496kb

input:

718932059831315182706462364529773768676708061907336954547187035974535766093827767454498018478469140216746895812841810206019622899194519447909137847371936931033953181640773394415366370706664193184038631289252858020530833893211842196817143200016389355008254515164705388461616409185836089055737770392643...

output:

3
6
2
3
8
7
9
9
0
1
1
4
2
7
4
0
5
5
8
0
6
5
0
7
4
2
5
7
4
7
8
7
8
3
1
1
2
2
9
9
3
5
9
5
5
6
9
7
2
6
1
0
7
7
6
4
9
8
6
8
6
9
1
1
0
4
5
6
2
6
2
5
3
7
7
0
8
0
0
5
7
9
4
9
6
1
2
6
5
0
0
9
0
5
5
9
9
3
3
5
0
2
3
7
8
7
9
4
3
3
4
3
2
2
5
9
8
4
8
1
3
3
5
8
0
4
8
0
2
1
4
0
7
0
8
5
1
8
1
7
0
3
3
7
7
3
3
9
7
8
...

result:

ok 49952 numbers

Test #27:

score: 0
Accepted
time: 78ms
memory: 18260kb

input:

158722144620077351189922197134965653566014181376197155449347891258646823422282706566879997682214785019515451107733055707189275279861133596748923805007719845914477778689693159104475646949774931656612604073878279411770973869309192013235057103148110142865325785974394966968872199377472447396269502420727...

output:

3
8
6
7
8
0
8
8
6
2
2
6
3
4
6
5
1
4
7
0
0
1
0
9
5
5
0
4
5
8
2
2
8
0
4
5
8
4
2
3
5
5
3
4
0
0
4
4
0
2
0
7
9
5
2
3
1
1
8
2
3
1
4
4
8
2
0
0
1
1
2
4
5
9
5
6
0
3
0
1
3
9
6
7
7
7
0
1
2
7
1
8
1
7
1
2
5
3
8
5
7
3
7
8
1
0
5
8
4
1
4
3
3
9
0
1
4
4
1
6
8
4
4
8
1
7
0
4
4
0
9
7
1
6
9
1
2
0
3
7
5
6
0
2
1
8
5
9
4
9
...

result:

ok 49996 numbers

Test #28:

score: 0
Accepted
time: 81ms
memory: 19664kb

input:

501287510870147142360213932369290901122355604715036290171542328040420800350453566343067923450987617250944172406616475317702228860114709287394927362227504441893193406326142956055952528438294806119584677482546611891872884375391168551943566578461954885387081059657349885141396872543580501625875087979702...

output:

8
1
0
4
3
8
6
1
6
3
4
8
6
8
1
9
4
3
9
3
4
5
5
0
0
8
9
2
7
1
5
2
5
3
5
8
1
6
2
3
8
9
7
9
7
3
1
8
7
4
5
6
5
4
0
2
3
2
0
0
3
2
5
6
2
3
5
0
6
4
3
2
2
0
2
2
6
9
2
0
2
2
8
9
7
2
0
8
8
2
9
6
9
0
0
7
7
4
7
6
0
3
0
6
4
5
4
0
3
7
9
1
3
0
3
2
9
1
5
6
6
7
6
3
1
2
0
9
1
0
6
2
6
6
1
7
5
9
8
2
3
1
1
8
5
1
6
8
0
5
...

result:

ok 49919 numbers

Test #29:

score: 0
Accepted
time: 78ms
memory: 19416kb

input:

983531335659850714237305115036381814632881994524659360579254102643487707235915545857468465624952465969179207997508273314512526847724504196989203165853520759810611610397876197045869205481142504783770762996803071888495250278889270018446830897176139078547940223147648023226517782191355929062667503183448...

output:

7
8
5
0
6
2
3
5
9
4
4
3
9
0
3
8
4
7
9
1
3
9
8
6
4
9
7
9
0
6
6
3
0
6
8
5
0
1
1
3
5
8
5
4
0
1
1
3
5
3
2
0
0
3
6
9
6
4
7
3
6
0
8
2
5
3
6
8
7
1
4
8
7
4
2
6
2
0
3
1
6
8
9
2
2
7
1
4
0
1
9
7
5
6
4
4
0
1
1
8
1
9
9
4
8
8
1
4
6
7
2
7
9
7
2
1
5
1
3
2
0
9
1
3
1
3
3
3
1
8
1
7
9
2
9
7
2
5
7
0
2
5
0
8
1
5
6
5
4
4
...

result:

ok 49998 numbers

Test #30:

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

input:

827030307242560487614476094431184703394125914292496809233071642481794604720174393950298843432638362104988564608361173912678179029091534947169200117923995645990205347314397552544956143644642022657356932363989516262595517188827254131752475665834296215608772836710698712394449072988867991384675648611482...

output:

1
2
5
9
9
3
5
7
1
4
9
2
7
7
5
8
6
9
9
9
4
9
4
4
1
3
1
9
9
8
4
8
3
8
7
4
1
6
3
9
9
4
2
3
8
6
4
7
9
7
3
6
9
6
8
3
5
5
6
5
5
6
2
1
2
8
0
4
0
3
5
6
6
2
7
9
3
9
0
0
3
5
8
3
5
0
6
1
6
6
4
4
1
3
2
6
5
0
5
8
3
5
1
4
8
4
2
2
4
8
0
7
4
1
4
6
0
0
5
6
1
8
5
8
1
6
1
8
6
0
7
5
8
4
5
1
7
0
4
7
3
0
5
2
6
3
1
0
2
4
...

result:

ok 49998 numbers

Test #31:

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

input:

770880411042039228626758466046299818846230475001259994665400864063795561108535778168695944606905994705297425809853518066205646046984144099350008834753857959817927925413345619695417623991790520101281427167231734473776423443975300499400949194375033618226435680450221336977907801910899759239307983968068...

output:

1
5
2
5
5
7
6
0
8
4
4
9
5
4
5
3
6
4
5
3
8
5
6
6
3
9
5
1
5
6
2
1
6
3
0
3
6
1
1
1
1
1
2
3
0
0
0
1
6
8
2
1
5
1
6
2
9
8
7
1
4
6
4
6
9
4
2
5
1
1
3
9
6
2
6
3
6
8
0
4
2
2
0
3
5
7
7
6
5
2
3
1
2
4
7
6
4
3
7
3
5
7
8
1
4
1
6
4
4
9
5
6
4
8
6
0
0
6
6
3
9
7
3
5
1
0
2
2
3
6
6
3
8
7
0
7
7
0
5
3
6
7
5
7
7
9
0
1
9
5
...

result:

ok 49993 numbers

Test #32:

score: 0
Accepted
time: 145ms
memory: 19560kb

input:

677626993975892499704039030543272430899275243910257911804799779050091046516452988178013531014268918811173939650642586439566406179191340032290242471164620397693718115937469230865639050202204033086180013798392250945514997389392089836361472892923108709052296874567465127993121832785182254870655135620662...

output:

0

result:

ok 1 number(s): "0"

Test #33:

score: 0
Accepted
time: 144ms
memory: 18236kb

input:

511480086753564282821528855178563929745572703769018450686519315364994143491916967272893579288334926852555836951575502077626800161580974941822438484334857675128558893510619871726746734393334541554012208506864881136634075294480149999489082362631943342210952658415428622030685123950393010171647050758706...

output:

8

result:

ok 1 number(s): "8"

Test #34:

score: 0
Accepted
time: 149ms
memory: 19692kb

input:

472330038062685403802290048373688812241446646131931548371358882106958120983785742309604463056365028053384497842197902484437459388258909692021136121000437587309020081655554248416237604736980589208691771671180049141616984590478595217573559381574160795133081222146011610538801003982869672106413196666521...

output:

9

result:

ok 1 number(s): "9"

Test #35:

score: 0
Accepted
time: 145ms
memory: 17736kb

input:

386233463881717072875581827146070520751747126770517661713166628789189627724980782503822688280432695205513144141020509128499902342551505341291338189246300115206785134828666443367135785829882467172883975489827563563779932862926264780289693656829908932995843695380306139371737193136677430867087011811629...

output:

8

result:

ok 1 number(s): "8"

Test #36:

score: 0
Accepted
time: 149ms
memory: 18108kb

input:

745583415671483224856063268315723013208093546585338940411563348183242984213440969816633586058807593886948284456364509705729509729228715032842535706716746469625245322861513742352222229050932105542759840801595902514973411977932610802947368055541931365403552209659301957818972982202503192705179196359265...

output:

9

result:

ok 1 number(s): "9"

Test #37:

score: 0
Accepted
time: 11ms
memory: 20424kb

input:

677626993975892499704039030543272430899275243910257911804799779050091046516452988178013531014268918811173939650642586439566406179191340032290242471164620397693718115937469230865639050202204033086180013798392250945514997389392089836361472892923108709052296874567465127993121832785182254870655135620662...

output:

0
9
1
5
5
6
3
7
8
9
0
6
0
5
3
2
8
1
4
6
6
0
9
7
3
3
4
1
4
4
5
8
6
5
4
9
3
6
7
9
7
1
4
4
1
1
3
0
1
5
1
3
4
4
4
9
1
1
6
5
2
4
7
5
5
1
8
0
6
4
6
2
0
6
7
6
1
4
4
1
4
4
9
0
3
2
0
3
5
8
8
2
4
2
3
9
8
3
4
9
9
4
6
7
9
5
9
6
4
7
5
0
7
8
7
7
6
3
5
8
5
0
4
1
6
3
0
1
3
7
8
9
5
9
6
9
1
8
3
0
9
5
4
6
1
5
0
3
8
1
...

result:

ok 100000 numbers

Test #38:

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

input:

511480086753564282821528855178563929745572703769018450686519315364994143491916967272893579288334926852555836951575502077626800161580974941822438484334857675128558893510619871726746734393334541554012208506864881136634075294480149999489082362631943342210952658415428622030685123950393010171647050758706...

output:

3
4
7
6
2
6
1
2
7
8
1
2
7
1
0
9
4
8
5
6
4
2
0
6
9
5
0
0
4
5
2
4
8
3
4
7
4
5
5
5
0
4
4
3
3
8
9
4
3
6
9
3
1
2
0
4
4
5
4
4
7
6
1
5
8
6
4
3
9
9
0
6
7
7
4
1
0
7
4
5
2
1
8
5
0
9
4
2
7
7
9
7
1
9
0
8
1
7
2
0
4
5
3
1
9
0
5
1
2
2
7
2
4
3
3
4
1
6
3
3
3
9
1
2
6
5
1
4
2
8
9
9
6
6
3
7
3
3
8
2
4
0
1
3
3
1
3
1
4
9
...

result:

ok 100000 numbers

Test #39:

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

input:

472330038062685403802290048373688812241446646131931548371358882106958120983785742309604463056365028053384497842197902484437459388258909692021136121000437587309020081655554248416237604736980589208691771671180049141616984590478595217573559381574160795133081222146011610538801003982869672106413196666521...

output:

3
9
7
1
1
7
0
8
2
8
6
7
3
6
1
7
0
4
7
7
5
3
4
0
5
5
4
2
8
0
0
0
4
3
1
4
1
5
3
2
2
8
4
3
9
2
4
7
7
3
0
9
2
3
0
7
3
1
0
2
4
0
2
4
0
5
6
9
1
3
7
1
2
9
2
4
8
1
6
3
6
7
9
6
5
8
9
1
1
4
5
8
1
8
0
6
9
7
3
0
4
3
2
2
4
1
2
4
6
1
0
0
6
8
1
4
7
9
5
7
3
0
3
5
8
5
1
7
9
9
5
7
3
5
5
7
9
1
9
3
2
4
6
8
4
2
4
7
1
9
...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 15ms
memory: 18008kb

input:

386233463881717072875581827146070520751747126770517661713166628789189627724980782503822688280432695205513144141020509128499902342551505341291338189246300115206785134828666443367135785829882467172883975489827563563779932862926264780289693656829908932995843695380306139371737193136677430867087011811629...

output:

7
3
1
5
5
3
4
8
1
9
2
0
6
9
8
8
9
5
5
8
4
5
7
8
8
2
8
4
8
7
7
4
5
0
6
0
1
8
9
5
5
3
6
1
4
8
4
5
9
7
5
2
7
2
1
7
1
8
6
4
5
0
5
3
1
6
5
4
8
9
2
6
2
5
1
8
6
0
3
5
1
6
7
1
4
3
8
8
9
0
6
4
2
4
7
1
8
0
1
0
4
9
4
1
0
6
6
6
8
6
9
5
8
0
2
2
9
0
8
7
3
8
2
1
1
1
4
7
0
8
3
4
6
9
9
5
7
6
0
2
5
8
4
2
5
8
6
6
1
8
...

result:

ok 100000 numbers

Test #41:

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

input:

745583415671483224856063268315723013208093546585338940411563348183242984213440969816633586058807593886948284456364509705729509729228715032842535706716746469625245322861513742352222229050932105542759840801595902514973411977932610802947368055541931365403552209659301957818972982202503192705179196359265...

output:

4
2
5
4
8
1
6
7
6
7
8
5
9
1
2
6
1
9
7
8
5
3
9
6
9
5
7
1
1
3
5
1
2
6
5
3
1
9
0
0
0
7
3
4
6
4
1
1
5
8
7
2
5
4
3
5
8
9
3
8
3
5
2
8
4
7
8
8
4
0
1
3
5
6
0
2
0
1
3
8
8
6
6
5
6
7
4
7
2
6
6
7
2
9
5
9
3
2
8
4
4
0
1
8
3
3
5
5
8
7
7
5
0
2
2
4
5
4
1
2
0
3
5
3
9
0
4
9
0
3
7
7
9
4
5
9
2
3
1
8
5
5
6
9
0
2
8
7
3
7
...

result:

ok 100000 numbers

Test #42:

score: 0
Accepted
time: 9ms
memory: 17764kb

input:

677626993975892499704039030543272430899275243910257911804799779050091046516452988178013531014268918811173939650642586439566406179191340032290242471164620397693718115937469230865639050202204033086180013798392250945514997389392089836361472892923108709052296874567465127993121832785182254870655135620662...

output:

1
5
5
6
3
7
8
9
0
6
0
5
3
2
8
1
4
6
6
0
9
7
3
3
4
1
4
4
5
8
6
5
4
9
3
6
7
9
7
1
4
4
1
1
3
0
1
5
1
3
4
4
4
9
1
1
6
5
2
4
7
5
5
1
8
0
6
4
6
2
0
6
7
6
1
4
4
1
4
4
9
0
3
2
0
3
5
8
8
2
4
2
3
9
8
3
4
9
9
4
6
7
9
5
9
6
4
7
5
0
7
8
7
7
6
3
5
8
5
0
4
1
6
3
0
1
3
7
8
9
5
9
6
9
1
8
3
0
9
5
4
6
1
5
0
3
8
1
7
0
...

result:

ok 99999 numbers

Test #43:

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

input:

511480086753564282821528855178563929745572703769018450686519315364994143491916967272893579288334926852555836951575502077626800161580974941822438484334857675128558893510619871726746734393334541554012208506864881136634075294480149999489082362631943342210952658415428622030685123950393010171647050758706...

output:

7
6
2
6
1
2
7
8
1
2
7
1
0
9
4
8
5
6
4
2
0
6
9
5
0
0
4
5
2
4
8
3
4
7
4
5
5
5
0
4
4
3
3
8
9
4
3
6
9
3
1
2
0
4
4
5
4
4
7
6
1
5
8
6
4
3
9
9
0
6
7
7
4
1
0
7
4
5
2
1
8
5
0
9
4
2
7
7
9
7
1
9
0
8
1
7
2
0
4
5
3
1
9
0
5
1
2
2
7
2
4
3
3
4
1
6
3
3
3
9
1
2
6
5
1
4
2
8
9
9
6
6
3
7
3
3
8
2
4
0
1
3
3
1
3
1
4
9
2
8
...

result:

ok 99999 numbers

Test #44:

score: 0
Accepted
time: 9ms
memory: 17952kb

input:

472330038062685403802290048373688812241446646131931548371358882106958120983785742309604463056365028053384497842197902484437459388258909692021136121000437587309020081655554248416237604736980589208691771671180049141616984590478595217573559381574160795133081222146011610538801003982869672106413196666521...

output:

7
1
1
7
0
8
2
8
6
7
3
6
1
7
0
4
7
7
5
3
4
0
5
5
4
2
8
0
0
0
4
3
1
4
1
5
3
2
2
8
4
3
9
2
4
7
7
3
0
9
2
3
0
7
3
1
0
2
4
0
2
4
0
5
6
9
1
3
7
1
2
9
2
4
8
1
6
3
6
7
9
6
5
8
9
1
1
4
5
8
1
8
0
6
9
7
3
0
4
3
2
2
4
1
2
4
6
1
0
0
6
8
1
4
7
9
5
7
3
0
3
5
8
5
1
7
9
9
5
7
3
5
5
7
9
1
9
3
2
4
6
8
4
2
4
7
1
9
0
0
...

result:

ok 99999 numbers

Test #45:

score: 0
Accepted
time: 145ms
memory: 19728kb

input:

677626993975892499704039030543272430899275243910257911804799779050091046516452988178013531014268918811173939650642586439566406179191340032290242471164620397693718115937469230865639050202204033086180013798392250945514997389392089836361472892923108709052296874567465127993121832785182254870655135620662...

output:

8
1
8
3
3
5
4
7
3
3
7
4
6
4
1
3
8
4
3
0
7
1
9
9
1
2
9
9
8
0
7
4
7
0
9
4
2
9
4
3
0
9
9
1
1
0
7
2
4
4
8
2
7
8
3
7
1
4
4
6
7
8
1
4
6
1
1
9
8
4
4
4
2
6
3
7
0
7
0
6
1
7
8
4
2
9
4
9
8
2
2
3
3
1
5
4
7
0
4
0
6
7
6
2
1
3
2
2
6
3
4
1
3
0
0
3
2
8
6
4
0
6
6
1
5
2
5
6
1
6
0
2
8
5
9
4
8
7
9
4
1
5
0
7
7
7
0
7
8
5
...

result:

ok 333 numbers

Test #46:

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

input:

511480086753564282821528855178563929745572703769018450686519315364994143491916967272893579288334926852555836951575502077626800161580974941822438484334857675128558893510619871726746734393334541554012208506864881136634075294480149999489082362631943342210952658415428622030685123950393010171647050758706...

output:

0
7
1
4
4
2
3
9
4
7
7
6
5
8
8
3
4
8
0
2
6
9
7
1
8
8
5
1
9
9
4
7
4
7
2
0
3
4
4
8
1
7
2
7
9
8
4
0
5
4
6
8
6
5
0
1
6
4
6
4
2
7
0
2
5
0
3
2
0
8
8
6
5
6
0
0
9
3
4
0
3
3
9
9
4
5
0
0
3
8
0
4
6
6
3
4
3
6
5
3
1
3
3
3
9
4
1
3
7
7
2
3
8
4
4
9
6
2
2
6
1
4
6
3
9
2
5
4
7
4
5
0
1
9
3
2
1
5
4
6
7
5
4
6
9
1
2
6
5
7
...

result:

ok 333 numbers

Test #47:

score: 0
Accepted
time: 152ms
memory: 18032kb

input:

472330038062685403802290048373688812241446646131931548371358882106958120983785742309604463056365028053384497842197902484437459388258909692021136121000437587309020081655554248416237604736980589208691771671180049141616984590478595217573559381574160795133081222146011610538801003982869672106413196666521...

output:

3
8
5
0
2
3
3
9
6
3
7
6
1
2
5
9
1
8
3
1
5
2
9
9
1
3
6
9
8
6
4
6
2
8
4
1
8
2
4
4
8
8
4
3
4
3
5
1
6
9
3
0
4
6
6
0
3
5
7
8
3
4
4
1
5
4
0
7
4
0
4
5
6
5
8
0
3
7
0
3
2
3
1
8
3
8
0
7
7
9
2
8
6
6
9
6
2
1
2
7
8
2
2
9
7
6
1
5
0
0
7
5
7
1
5
0
2
1
0
3
7
9
9
7
7
7
4
7
1
6
8
4
0
5
2
0
2
5
1
2
0
8
1
9
8
0
4
6
2
2
...

result:

ok 333 numbers

Test #48:

score: 0
Accepted
time: 145ms
memory: 18312kb

input:

386233463881717072875581827146070520751747126770517661713166628789189627724980782503822688280432695205513144141020509128499902342551505341291338189246300115206785134828666443367135785829882467172883975489827563563779932862926264780289693656829908932995843695380306139371737193136677430867087011811629...

output:

0
7
6
3
6
2
1
9
6
0
7
1
6
9
8
8
4
9
0
8
0
4
0
3
8
7
3
4
9
9
1
7
3
6
3
5
3
8
9
3
1
1
8
6
7
2
6
3
2
8
3
2
9
0
1
9
2
4
5
3
7
9
4
9
7
2
3
9
0
0
7
2
5
9
7
6
5
5
2
5
9
9
2
8
9
9
7
3
2
2
5
0
3
5
6
2
9
0
3
4
9
2
2
7
1
3
6
5
7
8
1
6
5
8
4
6
3
0
1
6
8
2
3
1
7
9
7
3
6
2
4
0
8
6
8
3
6
4
5
7
4
7
6
9
5
2
5
2
2
3
...

result:

ok 333 numbers

Test #49:

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

input:

745583415671483224856063268315723013208093546585338940411563348183242984213440969816633586058807593886948284456364509705729509729228715032842535706716746469625245322861513742352222229050932105542759840801595902514973411977932610802947368055541931365403552209659301957818972982202503192705179196359265...

output:

6
2
9
1
0
0
8
4
2
4
9
8
8
6
7
5
4
6
8
3
9
4
2
1
0
7
8
1
4
4
0
3
1
3
9
4
1
1
5
2
3
8
4
9
4
4
8
3
3
4
4
1
6
3
1
2
4
3
0
2
5
1
0
1
6
3
1
6
4
1
3
5
6
2
9
0
5
4
5
5
3
5
1
8
7
0
2
2
7
0
9
4
2
6
3
4
3
5
9
0
0
1
7
6
9
0
4
7
3
5
5
2
1
3
5
9
4
4
1
8
8
8
3
8
6
7
0
5
6
0
6
3
5
5
0
8
8
0
4
5
3
5
2
9
3
4
5
5
6
4
...

result:

ok 333 numbers

Test #50:

score: 0
Accepted
time: 133ms
memory: 20408kb

input:

687148149898590835128734096020818522700529479354111091949312960135002085101685319911019178222572129521797945953853905713726059302432395983082137469982521105165791059980657901801789909933674074000321433370751326550034923277070556265051872985662112168660614913449190413055498618459115952038181012606241...

output:

3
4
0
8
0
5
8
9
1
6
3
7
4
3
3
3
6
2
7
4
4
0
7
1
1
3
2
2
6
5
1
8
5
0
4
6
2
5
7
5
0
7
2
8
6
2
5
7
4
9
7
4
9
8
0
3
9
0
7
6
3
9
6
3
1
6
7
9
7
8
8
6
9
2
6
9
6
3
5
0
3
7
4
0
9
0
4
7
0
9
8
5
0
5
4
3
9
9
1
7
0
0
4
2
6
7
2
8
2
1
3
2
7
0
9
6
8
9
1
2
9
7
6
3
7
1
2
7
2
9
8
2
2
9
7
8
5
0
8
8
0
5
8
6
6
5
5
3
0
3
...

result:

ok 333 numbers

Test #51:

score: 0
Accepted
time: 141ms
memory: 18072kb

input:

511410590003206748743026837297269617156860999163734519503176440751003346982052198127800474000547281930526632644516345712652806992189907653673339456162173013088973643589761306561810879584560558973989908184836364781078674144968906782339481360394956565722773781126049434152414561245822910375917863114385...

output:

1
3
1
1
4
8
9
9
3
6
4
4
5
8
5
9
9
4
0
4
6
4
6
5
3
1
4
2
3
4
8
2
3
8
8
8
8
8
1
1
1
7
6
0
8
4
4
7
8
7
5
6
4
5
7
8
7
8
9
7
2
8
7
6
6
1
7
3
4
2
9
0
7
2
3
7
0
4
6
0
1
5
5
4
6
4
9
0
1
4
9
8
0
5
6
3
4
4
9
3
4
5
6
2
6
8
3
6
7
5
8
1
8
3
1
8
7
2
5
1
4
9
1
1
6
0
3
9
8
7
6
3
5
4
6
9
1
4
5
2
3
0
5
4
3
8
4
9
9
9
...

result:

ok 333 numbers

Test #52:

score: 0
Accepted
time: 133ms
memory: 18260kb

input:

412360324827978957176583694828310104622570454802673606075377276215378423471812273240200693215211478171394399847108642814672419979452510744863417210894498320009435941598606905856781313771012596687811178858150589131279746416550676044440596239657711594345549954832445910296588861477458018692941905242921...

output:

7
9
4
3
1
6
4
9
2
2
0
9
3
4
0
9
3
5
9
8
3
3
4
2
1
5
9
6
3
8
7
9
7
5
9
6
9
5
3
0
8
0
8
8
1
7
5
8
5
9
6
9
8
2
1
6
2
1
3
3
8
9
3
2
8
9
4
6
6
0
9
4
9
6
3
3
9
6
5
8
1
9
3
1
7
7
5
9
5
9
5
0
9
0
6
5
0
9
5
7
4
9
2
3
7
8
8
5
4
3
4
2
5
1
8
8
5
4
7
1
8
8
1
2
1
4
4
8
1
1
0
8
8
7
8
5
9
0
4
6
0
3
3
3
5
1
2
1
0
2
...

result:

ok 333 numbers

Test #53:

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

input:

100110101001010111011000011100110011010000000100101101000010100101010101101110001010100011000000011110000010100000000100111110111111100110000100000111100000101001110011000101001111010100011000101100101000100000100110110110011011110001010001110000111100001101110111101110101111010100111010100110010110...

output:

1
0
1
0
0
0
1
0
1
1
0
0
1
1
1
0
0
0
1
1
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
0
0
1
1
0
0
0
1
1
0
0
1
0
0
1
0
0
0
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
0
0
0
1
0
1
0
0
1
1
0
1
0
1
0
1
1
0
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
0
1
1
0
0
0
0
0
1
1
0
1
0
1
1
1
0
1
1
1
1
0
0
1
0
0
1
1
0
0
0
0
0
0
0
1
1
0
1
1
1
0
1
0
1
0
1
...

result:

ok 50076 numbers

Test #54:

score: 0
Accepted
time: 76ms
memory: 19672kb

input:

100110000101101110101110110000000100101010111101101000011111100100100011010110011100101000101011110110011100010111110101001011111111000001101100000001100110111110111010111100100001100101100010110101110101011000001010101100000000000111000000000101011000101010100100011000111111001001111000000100100110...

output:

1
1
0
0
0
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
0
0
0
1
1
0
1
0
0
0
1
1
0
1
0
1
0
0
0
1
0
0
1
1
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
1
1
0
1
1
1
0
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
0
1
1
1
0
0
1
1
0
1
0
1
1
0
1
0
1
1
0
0
0
0
1
0
0
1
1
1
1
0
1
1
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
1
0
0
1
0
1
1
0
1
...

result:

ok 49920 numbers

Test #55:

score: 0
Accepted
time: 88ms
memory: 17964kb

input:

100101011110010110100001110101111011011101111001001110111111010100101011100011110001001100100010000011110111101001110011000000010000001010001000010100111101101000101000000100011010010110010000101101111100001110000000010011101001010110001110110001110110110010011000111010011100000010111010101110101100...

output:

1
1
0
1
1
1
0
0
0
1
1
0
0
1
1
0
1
1
1
0
1
1
1
0
1
0
1
1
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
1
0
0
1
0
1
1
1
1
0
1
0
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
0
0
0
1
1
0
0
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
1
0
0
1
0
1
0
1
0
0
0
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1
0
0
0
1
0
0
0
0
0
0
1
1
1
0
1
1
1
0
0
0
0
1
0
1
1
0
0
...

result:

ok 49992 numbers

Test #56:

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

input:

101011010010101011000010010000010000100110101000111001000111000100101101001101010011100100101001101001011001110110011011010000110011100001100000010011111000101110100100010000100111100110101011100110010011011110000100000000111011000000010111101001110010000111011001000010101111101011110001000100010000...

output:

0
1
1
1
0
0
1
0
0
1
0
0
1
1
1
1
0
1
1
0
0
0
0
0
1
1
0
0
1
1
1
0
1
1
1
1
1
0
1
0
1
0
0
0
1
0
1
1
1
1
0
1
0
1
1
1
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
1
0
0
1
1
1
0
1
1
0
0
0
1
1
0
0
0
1
0
0
0
0
0
1
1
1
1
1
1
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
0
1
0
1
1
0
1
1
1
1
0
0
0
1
0
1
0
1
1
0
1
1
0
1
0
1
1
0
1
1
...

result:

ok 50019 numbers

Test #57:

score: 0
Accepted
time: 84ms
memory: 19556kb

input:

101000111011110010101100010001101101100100011001011111110110101100111011110101010100100011101000111001110101000010011010111111010110000010001100011011110011111000111101101000011001001101010011010111001110100110101110101110010010010011001001011101001100010110000110100100010100100000100111101110101011...

output:

0
1
0
0
0
0
0
0
0
1
0
1
1
0
0
1
0
1
0
0
0
1
1
1
1
0
1
1
0
0
0
0
0
0
0
1
1
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
0
1
1
1
0
1
0
1
1
1
0
0
1
1
0
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
1
1
0
0
0
0
1
0
0
0
0
1
0
0
1
1
1
0
1
1
0
0
1
0
0
0
1
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
0
1
1
0
...

result:

ok 49991 numbers

Test #58:

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

input:

800719764252417469005181328276113248143028634481777571492451554084193923566623258464664079636997273630861202042300324990848190073127306893635353881332152848851486502637654229907121230222828785733216336640614006938016432986096125606173452571731913534098129676129970652993988408886297864308634131129019...

output:

2
2
8
2
2
7
3
4
3
2
7
4
3
0
8
0
7
5
4
1
5
7
3
3
1
6
7
5
4
7
6
8
3
0
4
0
5
2
4
9
3
5
9
3
1
9
4
7
2
6
9
8
0
6
8
1
6
0
9
2
2
0
9
6
8
4
2
5
0
2
5
9
3
9
8
1
7
3
8
5
7
8
0
9
0
3
4
5
3
0
4
2
6
1
5
5
5
6
7
5
0
5
7
5
9
9
7
0
2
9
0
9
2
4
6
1
9
1
2
5
5
2
4
7
3
0
8
7
8
4
6
3
0
2
5
5
8
4
1
5
2
0
4
3
7
7
2
6
5
2
...

result:

ok 49968 numbers

Test #59:

score: 0
Accepted
time: 78ms
memory: 19720kb

input:

304056300541840711825314489357714591051050720491390725630905624295232558801006532077125677463291087864436005567859725176456554478353472444525226380419312626779479682570025682030815447902555918326092780183991456670487752734379852746772879086463402989477395734389965214729657499085495014022870629201173...

output:

2
7
3
3
1
8
6
6
6
5
3
4
3
0
8
6
2
8
9
0
3
7
7
0
2
0
7
1
4
3
7
6
8
6
2
6
1
5
1
8
4
4
3
5
0
4
5
3
6
4
6
6
7
1
2
3
9
2
3
8
8
2
8
2
7
1
8
5
3
4
7
1
8
5
8
4
1
8
8
0
4
5
3
4
2
5
8
7
6
2
8
3
5
8
8
4
8
4
7
1
8
5
7
1
0
5
8
7
5
3
6
8
5
8
0
7
6
5
9
7
5
7
4
1
9
4
6
6
0
5
6
8
5
2
1
9
2
3
1
5
5
3
6
2
3
9
3
7
6
3
...

result:

ok 49925 numbers

Test #60:

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

input:

254899625149923471734949140953396137008701269815788576851053993441173944319773045811527766225181679296504698115138571281910418486999673521711032822421779572544563893202023191096655218440772860250807931633738910735479497946291378138227593180600509440608364642036402255987552600697967004808372293440576...

output:

0
6
6
6
3
5
5
5
6
6
3
2
2
8
2
6
0
4
4
1
1
9
7
8
1
4
8
8
7
7
3
8
9
6
5
8
7
2
3
6
6
7
7
0
8
8
0
7
1
0
1
4
7
3
7
2
9
0
1
4
3
0
0
9
0
9
9
5
5
6
6
8
6
7
2
5
1
3
8
3
4
7
4
9
1
7
8
7
8
4
3
5
0
8
8
7
1
5
1
5
1
1
5
4
8
0
4
1
1
9
9
8
2
2
9
6
0
1
7
1
5
8
8
8
8
4
2
6
9
2
9
1
8
5
2
2
9
6
3
8
2
8
2
1
2
0
7
8
9
4
...

result:

ok 50030 numbers

Test #61:

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

input:

157002905989998123962638227683107365486685318585558644842125598868812796278170320479841963098610593884617267620616341425448810002214009236063569631517691828502141333997454194078797407728409813211583045626761308419330102853184000579444513361350168484371942605355232432747277635296109864161516766161331...

output:

4
7
9
6
5
6
0
8
8
8
6
7
6
3
0
5
4
0
7
8
9
5
0
4
2
6
5
5
5
9
8
2
7
8
0
9
7
2
7
0
9
4
5
0
6
9
4
5
5
3
9
4
3
9
6
9
0
9
6
7
4
3
0
9
3
1
2
4
4
9
1
3
9
3
8
1
6
7
0
9
9
4
3
6
1
3
6
4
1
9
8
2
5
7
6
5
8
4
6
3
1
7
5
0
1
2
8
8
4
3
6
8
6
4
1
1
4
3
3
0
1
0
5
6
3
9
1
5
6
1
9
6
5
9
1
1
5
7
4
6
2
7
7
7
2
0
1
7
1
5
...

result:

ok 49923 numbers

Test #62:

score: 0
Accepted
time: 76ms
memory: 19504kb

input:

933305880170361844775012998784342055493298694945932868089230867913241153894572800183963085419780129359781856334035192751801834420656979283159470530493897342306193016916252603905477265662076595941744291179548694075701262065708481563904158875999635599742530113932301614183386840461298852841157140745796...

output:

6
1
1
4
7
8
5
7
3
5
8
2
4
6
1
4
7
7
0
4
8
3
5
7
3
1
0
2
7
7
8
2
2
7
0
4
6
3
7
9
9
2
7
7
6
6
4
6
0
4
7
4
8
5
7
5
8
5
6
8
0
3
6
7
4
9
6
7
7
1
7
1
6
1
6
5
6
3
3
3
0
3
9
7
4
0
1
9
2
9
5
6
2
6
0
1
4
6
2
8
5
3
8
9
2
9
0
8
9
0
6
0
8
1
1
9
2
5
0
6
9
2
3
8
7
1
9
5
6
4
9
6
2
7
4
0
9
9
4
3
6
3
9
6
7
2
6
4
1
5
...

result:

ok 50027 numbers

Test #63:

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

input:

801745476058387134132648777425548132562286647669233810020349889032369655813124818523642972202888731364640981428062667427711549197197629980869840643191420201298695124194661612433174569662596825819029494609404027809147949960912379144056744617702409797846619899343951639383815576325407710725009520545365...

output:

6
6
1
6
6
2
6
0
4
8
8
4
6
3
4
0
2
4
0
5
3
7
1
8
8
9
4
3
1
2
8
8
6
5
8
7
1
4
5
6
9
6
0
8
9
8
2
7
4
9
0
5
4
0
0
1
2
2
4
9
7
2
8
4
6
3
6
1
0
6
5
3
5
9
7
9
6
6
0
9
7
6
0
8
1
1
2
6
4
6
4
4
5
1
5
4
9
2
4
9
8
2
4
5
8
8
1
6
9
4
2
6
3
1
3
2
2
4
6
0
6
4
3
4
9
1
4
3
0
9
6
2
2
9
7
0
5
3
6
4
5
1
9
3
1
3
7
0
2
3
...

result:

ok 50000 numbers

Test #64:

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

input:

345304801851495749015709302600649225810527157439076460575757465485424552301322797627058001470551369708915608723395767898430997353396242679059042802217005541519747772167517887428297849459442503567611387414776062236301451866860442263774244486863296594061810761625846558487971756452217178026687665083341...

output:

7
7
0
3
2
1
4
8
1
0
6
0
3
6
4
6
0
1
9
8
8
8
8
2
9
6
8
7
6
7
2
3
7
6
8
8
3
5
7
8
8
2
9
2
0
3
2
2
0
4
6
0
6
3
7
4
2
9
9
2
0
5
7
8
2
4
2
7
0
4
7
8
9
3
7
3
8
4
9
8
4
9
5
1
7
8
0
6
3
9
2
7
3
7
1
4
9
1
7
9
0
0
2
0
1
9
0
0
5
0
6
3
2
5
3
7
8
0
1
9
6
1
3
5
2
5
9
8
3
9
0
9
3
8
9
3
4
4
5
5
8
3
2
0
3
6
4
3
6
5
...

result:

ok 50000 numbers

Test #65:

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

input:

249654937744105363080291787815934134397051576258699549153518901469632713822797546830039065284726200913781757474217182538600400344060258520676040329407933051096221450280209240370768723742924447471259353882839980482802562371858458727928813705584453121125584904556849736524955640048129130385493921231087...

output:

7
9
5
3
3
3
9
4
4
4
6
2
7
3
9
0
3
7
9
1
7
4
5
1
6
7
0
1
0
1
9
6
8
6
0
1
5
3
1
6
8
5
1
3
0
7
5
6
7
0
0
1
0
3
8
1
1
3
0
8
4
5
8
1
4
5
7
0
9
2
6
9
6
0
1
1
9
0
2
9
2
4
6
8
5
3
2
9
0
6
9
0
8
4
6
8
4
2
1
3
0
3
5
2
3
1
9
1
5
9
7
9
0
2
1
9
8
0
6
2
8
0
8
8
5
1
9
7
2
9
4
1
0
6
0
4
6
9
2
6
6
8
8
2
4
5
5
8
3
4
...

result:

ok 50000 numbers

Test #66:

score: 0
Accepted
time: 78ms
memory: 20420kb

input:

170958982923278176468388584822586829287307816081538676601312481021093036611612524339449089472491218052710493125140594536306447920353424273260846566113318009217763041284766885061791483969870515845182546396115784487046682283990730044626365113496291920386249978198894448161011937270797940212425666388081...

output:

8
2
1
4
8
2
1
8
5
4
6
0
4
4
4
6
9
1
8
0
2
5
3
4
7
8
6
2
4
9
2
6
3
1
6
7
2
8
8
1
1
5
9
3
4
7
3
0
0
0
7
6
4
9
4
4
4
1
7
9
5
5
8
7
9
5
3
1
6
5
4
6
0
4
0
9
3
3
8
1
8
9
8
5
5
9
6
1
8
6
5
4
8
8
2
5
3
0
5
7
8
4
1
0
3
8
2
3
8
7
0
2
3
8
9
4
7
4
1
7
0
3
2
9
5
5
2
3
1
3
4
9
5
2
4
1
6
5
5
1
7
0
0
4
3
9
6
5
5
7
...

result:

ok 50000 numbers

Test #67:

score: 0
Accepted
time: 81ms
memory: 19604kb

input:

930807314751988325439644926093871215847808938498195715343125813405998197509874369061220957256069914217589050226788530187993594501920648364419824174759184311132489771857614884912852213252528914309358017705867743859109079588382780102310030072739216657206301322829787069808507863406429627953833501874796...

output:

0
5
8
5
2
1
8
7
9
2
5
7
8
9
4
4
5
5
5
6
7
2
2
5
1
6
6
7
7
2
2
8
6
5
5
9
2
3
8
3
8
9
6
2
0
1
0
5
6
5
8
9
0
5
2
3
5
3
1
5
8
3
6
5
0
0
6
8
3
8
7
6
7
4
9
8
1
2
5
7
9
9
6
7
3
3
0
4
8
5
0
5
1
8
5
2
5
4
8
8
9
4
0
7
0
9
1
3
1
1
6
3
5
3
9
1
7
6
3
5
6
4
4
2
1
7
2
6
3
7
2
0
2
4
4
8
2
8
5
8
9
8
8
5
4
2
0
7
2
6
...

result:

ok 50000 numbers

Test #68:

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

input:

800719764252417469005181328276113248143028634481777571492451554084193923566623258464664079636997273630861202042300324990848190073127306893635353881332152848851486502637654229907121230222828785733216336640614006938016432986096125606173452571731913534098129676129970652993988408886297864308634131129019...

output:

6
8
6
5
8
4
5
7
8
8
9
9
0
3
3
0
7
4
2
7
4
3
3
1
8
8
3
2
5
2
9
5
4
3
8
5
6
9
2
3
7
9
7
3
5
0
8
9
7
8
5
5
3
1
0
6
4
4
6
5
8
4
1
6
1
1
3
7
1
7
8
8
9
7
3
3
1
6
6
8
2
3
6
4
1
9
2
4
9
7
4
3
2
9
1
0
1
3
8
9
0
9
5
7
8
9
7
3
7
3
6
7
4
1
5
4
0
6
9
2
3
4
8
6
1
1
0
5
9
0
8
0
8
6
2
4
6
9
2
5
9
2
1
0
5
5
3
6
8
7
...

result:

ok 50000 numbers

Test #69:

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

input:

304056300541840711825314489357714591051050720491390725630905624295232558801006532077125677463291087864436005567859725176456554478353472444525226380419312626779479682570025682030815447902555918326092780183991456670487752734379852746772879086463402989477395734389965214729657499085495014022870629201173...

output:

0
9
5
1
5
3
3
5
8
9
9
7
6
9
3
0
3
0
4
7
1
8
7
1
8
8
8
2
3
9
0
9
4
0
5
7
2
0
3
3
5
6
9
0
6
9
8
0
6
2
8
7
7
6
2
4
1
1
0
1
9
4
9
8
6
0
1
2
5
3
2
8
9
6
7
1
5
9
8
6
8
8
1
9
7
8
4
6
1
9
0
5
7
8
3
1
1
8
1
1
2
2
0
5
8
7
4
8
7
9
0
4
8
1
3
9
4
4
3
1
8
4
8
9
5
9
8
1
3
0
1
9
7
9
2
0
8
2
8
5
0
5
5
1
5
4
4
8
8
7
...

result:

ok 50000 numbers

Test #70:

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

input:

254899625149923471734949140953396137008701269815788576851053993441173944319773045811527766225181679296504698115138571281910418486999673521711032822421779572544563893202023191096655218440772860250807931633738910735479497946291378138227593180600509440608364642036402255987552600697967004808372293440576...

output:

9
4
9
1
9
9
6
1
8
8
8
8
2
5
8
1
8
2
3
6
6
4
1
2
5
2
2
4
9
2
4
0
1
2
0
8
6
5
0
1
8
3
6
8
8
6
1
7
2
2
0
6
9
5
4
5
8
6
9
4
8
9
3
3
9
6
6
4
7
6
9
3
9
7
8
9
9
7
8
0
9
1
2
3
1
6
9
9
3
4
2
5
0
5
9
5
5
7
4
6
6
3
8
9
4
8
8
2
7
8
7
6
4
3
1
3
9
4
4
6
9
1
0
9
0
5
2
8
7
9
7
2
4
1
2
5
0
2
3
1
8
7
0
0
7
6
9
3
5
8
...

result:

ok 50000 numbers

Test #71:

score: 0
Accepted
time: 78ms
memory: 18344kb

input:

157002905989998123962638227683107365486685318585558644842125598868812796278170320479841963098610593884617267620616341425448810002214009236063569631517691828502141333997454194078797407728409813211583045626761308419330102853184000579444513361350168484371942605355232432747277635296109864161516766161331...

output:

4
7
9
8
0
9
5
6
7
9
5
8
9
5
0
2
7
0
2
0
3
1
8
6
0
6
1
2
7
8
9
1
0
7
6
0
2
4
8
4
9
9
1
8
1
5
9
5
0
5
9
1
9
9
0
7
8
9
5
2
7
7
5
3
7
7
6
3
0
4
0
1
6
7
5
8
1
0
3
3
3
5
0
9
3
9
9
5
5
5
7
1
9
3
3
0
5
1
7
6
6
2
0
1
0
9
0
1
1
5
1
9
8
9
4
7
1
2
3
1
7
9
6
9
2
6
8
3
7
7
8
7
8
9
9
6
6
4
4
4
8
2
3
8
6
4
1
5
4
7
...

result:

ok 50000 numbers

Test #72:

score: 0
Accepted
time: 78ms
memory: 19684kb

input:

933305880170361844775012998784342055493298694945932868089230867913241153894572800183963085419780129359781856334035192751801834420656979283159470530493897342306193016916252603905477265662076595941744291179548694075701262065708481563904158875999635599742530113932301614183386840461298852841157140745796...

output:

3
9
5
1
0
4
0
8
8
1
8
8
0
1
6
3
1
1
2
2
7
8
2
3
6
3
6
1
2
2
6
1
6
7
3
6
6
5
8
2
8
6
7
7
0
8
5
6
0
6
7
1
2
1
9
6
2
4
8
0
4
8
7
5
8
2
9
4
2
7
3
8
1
1
3
6
8
4
7
3
6
6
1
7
9
1
8
5
5
2
2
2
8
7
8
4
6
8
9
0
5
7
1
9
9
4
1
6
3
3
0
9
6
2
9
9
2
7
1
9
9
3
6
5
7
7
0
8
2
1
7
5
9
3
5
7
6
1
1
1
4
4
6
9
4
1
2
2
5
2
...

result:

ok 50000 numbers

Test #73:

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

input:

285709869907206355232459026675565885504868076163153755060778503658991609727576873573500587097237628795839299276243066674313031398141319808467611945406551581818450775924234535004609308034735683390815398718041057094145996486382059147122124337637477826050053843985474928246105480512797092305778388929346...

output:

-1
-1
-1
-1
-1
-1
-1
-1
2
1
5
9
3
0
3
9
2
8
9
6
8
3
5
3
5
3
8
2
6
7
1
4
2
9
9
3
7
5
7
2
8
2
2
9
0
1
9
2
7
8
8
4
8
8
1
2
4
4
6
3
8
4
3
0
2
0
5
2
5
7
2
0
0
4
5
4
9
3
0
0
0
7
0
6
6
3
5
6
9
3
0
1
4
7
0
7
2
4
6
1
8
9
6
3
4
7
3
7
6
3
6
4
4
1
6
6
3
3
1
3
0
0
2
1
6
1
6
8
9
5
2
3
0
6
9
3
1
7
6
6
0
9
5
6
5
1
...

result:

ok 50104 numbers

Test #74:

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

input:

564420538499973325793368541094671152440681126420345882310296885375848490698888329260652904140688767161771603975105089667189860853983499122639120253832195826088452503412332496679133863996441886120362363714125195468605340891865238983158336312864177680882920242046606907529704055507742945753955757378134...

output:

9
2
5
1
9
6
1
8
5
4
8
3
6
0
9
5
3
6
6
9
2
6
6
3
7
1
8
0
7
6
7
7
2
1
3
8
5
1
1
6
4
8
3
6
8
8
8
1
1
4
5
6
6
5
0
6
9
6
7
7
9
7
4
2
8
4
7
9
2
1
7
0
7
0
5
2
2
1
2
5
5
5
5
8
7
4
9
0
2
3
3
0
6
3
1
2
4
5
2
3
7
3
1
7
3
8
5
4
8
2
3
8
9
5
7
1
1
8
2
5
0
2
5
5
7
3
5
9
2
1
3
6
9
3
2
5
7
8
0
3
4
0
9
4
6
0
1
3
6
5
...

result:

ok 49948 numbers

Test #75:

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

input:

892235850113137652914000414889908279053754677755606737169541262839001829747658879812313243934308336943930701778438654654699489807619127801700030530864134724542836320104606904373163578303675680679098268690225797443557577292244675279816624096317224272915301859233281321437480070644892458728912827970708...

output:

0
5
5
5
6
3
7
7
7
7
0
8
6
6
7
5
6
1
2
7
7
4
9
3
2
1
1
0
6
5
1
4
9
8
0
2
5
6
1
6
4
9
5
0
1
3
1
7
0
5
9
2
4
4
8
0
7
4
6
7
0
8
5
9
9
6
7
9
5
5
4
8
8
3
9
2
4
5
8
7
2
5
5
0
2
0
1
1
6
1
6
9
7
3
6
4
6
1
5
4
9
8
4
0
7
6
8
0
1
9
9
5
0
8
2
2
5
2
8
1
7
2
0
5
7
1
1
4
5
1
8
0
0
5
1
9
8
6
4
1
3
0
3
3
1
1
8
0
1
2
...

result:

ok 49989 numbers

Test #76:

score: 0
Accepted
time: 81ms
memory: 17788kb

input:

468381810010450252512039403546735736888215092575531837232064376055150187551843769944402804726549121765600877694661871958443591593617905768723899591944954428999222999424355150448812652508695853241625353577094985936628173777709505634846772389787068962078440229181239042937448664440913003243722190001156...

output:

7
9
4
8
3
4
7
8
7
0
7
5
7
0
2
1
7
4
5
6
7
2
9
1
4
3
0
7
4
3
0
5
4
6
0
0
7
2
5
1
5
1
7
7
6
1
4
2
7
6
5
9
8
1
7
2
3
0
7
0
3
2
2
0
8
0
7
9
1
3
0
2
2
2
1
5
6
4
9
2
8
1
0
3
0
0
6
3
7
0
6
8
6
2
6
3
1
5
3
0
4
0
2
9
9
7
1
3
6
2
7
8
4
2
8
2
3
4
8
9
7
6
9
2
4
9
0
0
5
3
4
5
2
7
9
6
6
7
1
2
1
2
9
5
4
8
8
4
8
0
...

result:

ok 49951 numbers

Test #77:

score: 0
Accepted
time: 78ms
memory: 20460kb

input:

404471302470010131097261847777829168842960309837300318486689821719249512989452989315892084264440865642932475742628808785907682310377978193947287769954342055484416436622133505376330982353493531745455112624065812274797642455448562042806978102697481507118700383895878558389814720763350785782473386375179...

output:

4
6
6
8
6
1
3
8
1
7
7
6
3
4
0
0
2
7
1
8
3
7
6
0
9
7
5
9
7
1
9
9
5
0
6
6
8
2
0
1
9
7
4
8
2
5
7
1
5
9
5
9
2
6
0
3
5
8
0
5
1
6
6
1
0
3
1
7
7
6
4
3
9
5
7
0
7
1
6
2
1
4
6
9
9
4
9
4
0
9
1
0
0
4
9
0
6
3
0
1
9
8
4
3
7
5
3
2
8
4
3
2
7
5
1
6
2
8
9
4
5
7
5
3
1
6
1
1
8
1
6
2
5
9
4
7
2
7
6
1
4
6
6
0
8
3
8
8
3
4
...

result:

ok 49995 numbers

Test #78:

score: 0
Accepted
time: 83ms
memory: 18040kb

input:

943384906421810164447606120666295023862209312661409131877517372049943169923377846804154699455546078013605641531704557353931912000621340729868532507461412745320068491853933281831085099994561345996285722938566402224993864858752114290265689174288389363476516072777849780362588722959182043336187964355619...

output:

8
1
3
0
1
8
2
9
4
0
7
7
8
2
7
7
6
5
7
7
2
2
1
8
1
4
0
3
5
1
0
9
1
3
4
5
9
8
5
4
2
8
9
7
0
0
8
6
4
3
8
4
5
8
5
3
9
6
4
3
3
6
3
1
7
3
9
3
3
6
4
6
9
4
4
7
1
1
4
5
5
1
4
1
5
9
1
7
5
8
3
2
7
3
2
6
6
3
3
5
3
3
5
4
2
2
4
4
4
8
9
5
3
8
2
6
8
7
8
1
1
0
9
3
4
0
1
3
4
3
7
0
5
7
9
2
3
8
2
5
6
8
5
0
2
9
9
2
5
5
...

result:

ok 49909 numbers

Test #79:

score: 0
Accepted
time: 74ms
memory: 20400kb

input:

126648252182318624501749455840106372030164189992902904539503186661873360502335952686311548205202256900668554347835862251339588313794945597059617562026993299899936363933718775155716086527275868644741583586387899440245442991270705205436889193953694219876275453822463443033763789304124178218700223477380...

output:

-1
-1
-1
0
8
9
0
2
6
2
2
6
8
2
8
7
1
6
1
1
5
5
2
3
2
0
5
7
8
7
5
0
2
0
4
7
6
3
3
7
5
7
3
6
3
4
7
7
9
6
8
1
1
6
6
0
1
6
8
8
6
9
5
3
9
1
6
3
6
7
4
9
8
8
5
8
2
3
2
6
3
2
0
2
2
9
1
6
3
6
7
7
5
9
5
3
6
0
8
8
1
8
6
9
7
0
9
1
0
4
6
6
1
9
9
8
7
3
4
2
4
2
3
0
1
1
2
1
5
9
0
7
3
7
5
0
7
9
3
4
9
0
6
5
5
7
4
2
2...

result:

ok 49932 numbers

Test #80:

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

input:

445379560288049937106853966075833645541937648269188329998096351717611917587603308337052389318573759976905354266788889268845309847636609871228128712048572532955934280685081205964204599873949364377814558428222537821787655766613348246276089211540320023305695226279056427007760345759834363464767592425938...

output:

9
0
9
7
6
3
8
1
2
8
9
4
8
2
5
2
3
4
1
8
2
3
2
0
5
4
7
2
6
9
0
4
0
4
9
6
6
0
2
2
0
8
7
0
8
8
5
7
4
2
6
0
4
2
9
1
8
8
2
9
9
3
1
0
1
3
8
4
1
1
1
1
4
1
9
9
0
9
1
2
8
4
3
5
1
4
9
0
6
4
0
5
5
0
3
5
8
6
0
7
2
0
6
9
8
9
5
6
6
0
9
9
7
0
2
5
2
2
9
7
5
1
7
4
3
5
8
8
5
6
4
1
5
9
5
9
1
3
4
0
6
6
7
5
1
6
1
8
3
1
...

result:

ok 50003 numbers

Test #81:

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

input:

784034242980845905931562859497199566543001192561429858768342034493046401234522868326160765708973418344749008415440090692211938860906139551309237091994139078569658039745741429234131054350191368127470943208526069894650098697146725732969794456638463479033066829314240382594555350830029270676904562508344...

output:

5
8
4
6
2
3
9
3
8
6
5
6
1
7
5
4
5
6
4
5
1
5
5
7
7
5
7
0
4
9
7
3
3
4
4
3
3
7
7
9
6
2
5
0
7
9
9
2
9
7
4
7
6
1
8
5
0
8
5
6
2
9
3
9
8
5
0
5
0
8
3
6
9
0
2
3
4
9
9
1
3
2
8
0
8
2
9
4
5
8
7
8
3
5
8
4
6
9
9
0
2
8
3
5
2
6
4
0
3
9
2
7
3
3
7
0
8
2
7
1
8
4
2
0
7
3
4
5
3
5
8
2
3
3
1
4
9
8
8
9
6
5
5
3
0
3
3
6
8
2
...

result:

ok 49982 numbers

Test #82:

score: 0
Accepted
time: 88ms
memory: 20388kb

input:

749230286239163842199111643717030240348781162389714918890253892071657104446663504353092099551554719170479528385599272550029745574884915457988875054056751918010086127507889573901399122199537247101357524981737909982880569883891653531764248818899242209292142893787234621480664558232744961573994935155851...

output:

4
7
1
6
0
4
7
8
2
3
3
6
7
7
2
5
8
0
7
2
1
6
9
5
8
2
8
5
9
5
5
7
5
4
7
0
3
8
6
1
3
9
3
9
4
3
7
4
2
7
3
3
8
7
1
4
4
8
5
9
5
1
3
2
2
7
2
4
3
0
2
8
3
2
4
0
3
4
9
2
9
0
4
7
4
9
4
5
5
4
2
2
9
7
9
5
9
9
8
1
1
1
8
1
3
7
1
3
7
7
6
4
3
9
2
5
6
9
6
2
0
0
1
4
5
0
8
4
3
5
0
7
7
6
5
1
3
6
1
9
4
3
2
0
7
2
5
9
8
3
...

result:

ok 50032 numbers

Test #83:

score: 0
Accepted
time: 76ms
memory: 18372kb

input:

308021339058136704063332643942144853103257684862985639918000361391645455864212924418292608432518057891900032887116807165938489937024574084579485626764259109105230124795469944227903864844339459219021041732001424624837550921546138960962844273355228300031839352555879174586475413950468191014505801803113...

output:

9
1
8
2
0
2
5
6
0
1
3
9
1
9
1
2
5
6
3
2
8
8
6
5
4
0
9
5
3
4
8
9
5
0
2
9
6
8
2
1
5
4
2
3
6
6
6
8
7
8
7
0
5
9
1
2
9
6
2
5
5
1
7
6
9
3
8
8
0
9
6
7
2
7
8
4
5
7
7
0
5
4
4
6
7
9
4
1
5
6
1
5
4
3
1
7
1
2
7
8
4
4
1
2
1
9
3
0
2
6
3
6
2
4
6
4
5
1
4
6
8
8
6
5
8
6
3
8
7
3
0
7
8
4
2
2
5
3
3
5
0
3
3
9
3
6
4
5
6
5
...

result:

ok 49957 numbers

Test #84:

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

input:

302843932610937775880794565252380902718505691474322288209351898463004487385732031507554017623211968816033380032263355323502929697099940070057314310037209689287724189434738880520156931167661123764777992046824680356097775794740148353983292502205307790630386645317834706129164652147398605635999830413715...

output:

6
1
7
8
0
4
2
4
8
0
4
7
2
4
2
9
2
5
4
0
9
7
0
4
3
8
4
9
0
1
9
9
4
9
8
5
8
2
4
8
8
7
5
8
6
8
9
6
7
7
8
8
4
0
9
8
9
0
7
3
2
4
4
4
5
0
2
4
8
5
3
0
3
7
2
7
6
3
5
5
3
2
4
2
2
6
2
9
6
0
1
2
2
1
5
6
3
8
1
6
7
9
5
6
0
8
8
7
9
8
3
6
1
1
2
3
3
9
2
2
6
5
9
3
2
3
5
9
0
7
4
3
1
9
6
6
2
6
8
5
0
9
5
0
4
2
1
1
2
8
...

result:

ok 50008 numbers

Test #85:

score: 0
Accepted
time: 55ms
memory: 19352kb

input:

137638755941792867271459270259837367708257358786381870077088219568196710730914440913764097084933427869335394873313282259225272854720223340483088891924986431544483294291387640153784667529630576964731474162790595868876084160595602315637530413136272661719955107705642298539699126948235343174017938834132...

output:

1
4
1
6
9
4
1
8
9
4
8
4
9
3
7
7
6
8
3
6
1
1
5
6
5
8
7
0
4
1
5
8
4
1
7
8
3
4
1
7
0
2
5
0
7
9
8
7
3
6
5
2
1
7
4
2
2
1
1
7
0
3
6
4
3
5
6
8
1
6
4
4
1
5
4
7
4
0
6
2
5
6
2
5
6
9
6
0
4
1
4
7
7
3
2
8
1
2
9
4
7
0
1
9
7
6
8
6
5
8
5
0
6
8
5
0
0
9
4
4
4
1
5
5
3
5
9
0
2
9
6
3
5
7
5
9
3
7
6
6
8
0
1
5
3
4
5
6
5
6
...

result:

ok 49927 numbers

Test #86:

score: 0
Accepted
time: 62ms
memory: 19324kb

input:

925866890852669694877163307158926806057889950746400454963538496577421495943209707602368275108153795610101761014921273101247984924333447398285966356851817485444727484607992385019329380869085784308111490080738997253144692635741659143968355519741872878487281349764912169627859521767788971271242903211409...

output:

0
8
9
4
2
9
6
4
8
5
2
0
7
1
8
3
7
0
8
8
3
3
3
6
5
0
3
5
2
2
4
5
3
3
5
5
7
3
9
9
4
9
0
2
8
2
9
3
5
8
8
8
9
3
6
7
2
7
3
5
9
6
1
1
0
9
7
3
3
8
3
6
4
1
8
5
0
9
0
2
3
1
3
4
6
4
9
1
0
0
7
3
6
4
3
6
3
6
3
9
1
5
6
4
6
3
3
1
9
9
9
8
6
7
9
9
3
1
6
6
8
3
4
7
8
4
9
7
1
3
2
6
9
6
5
0
4
4
6
0
2
8
1
6
7
4
2
4
8
1
...

result:

ok 49948 numbers

Test #87:

score: 0
Accepted
time: 65ms
memory: 18272kb

input:

272513428703170525612213348350073570845684879605033818446747270410787047364284014898968346401541478488790966862706992410799400270632280453937879853567168220301474880178185296972074058277540758510200643269025921768062701732517456577813236312098514156112333971149487615852891491559228973360094859334003...

output:

3
9
8
6
2
4
6
3
7
6
7
8
2
0
9
7
3
8
8
2
9
3
8
7
9
7
0
6
8
7
4
5
0
0
3
5
3
2
3
5
7
5
9
1
0
8
8
5
7
2
4
8
3
7
8
9
9
8
7
8
4
7
7
3
3
4
9
5
3
6
6
3
7
1
5
2
8
7
8
2
3
4
1
2
9
6
8
6
1
9
7
9
1
7
7
8
5
0
8
3
1
3
1
3
0
9
9
6
2
9
6
1
7
3
8
0
6
9
3
9
0
6
7
5
9
6
8
2
7
0
9
2
9
6
6
1
1
9
4
4
3
8
3
6
4
8
6
8
5
7
...

result:

ok 49969 numbers

Test #88:

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

input:

572678255740950557055698489018284594810423815125869414803193593875117298470481692483037775198815874105398616398747168942027296793384149001132839050375356989663267706319580440645416798518540289987954698871591578612425880645847143600256071450467228071125861894009650764257388881776779765513793028379353...

output:

8
1
4
7
1
0
1
5
2
9
7
8
1
0
6
1
4
2
3
9
4
3
1
5
6
1
6
0
9
5
6
5
6
1
6
3
1
8
9
4
3
0
8
3
5
1
5
6
0
8
1
4
3
4
8
8
8
9
0
9
5
3
2
6
7
3
8
2
2
6
3
8
2
4
9
5
9
7
0
3
5
4
6
9
1
9
8
3
5
8
5
4
8
3
5
6
5
0
0
3
6
7
3
9
1
9
7
2
8
5
2
3
0
6
5
9
1
6
5
1
6
3
1
7
9
7
7
7
1
6
2
7
6
5
4
7
8
0
1
1
0
1
4
5
4
7
8
6
0
4
...

result:

ok 49933 numbers

Test #89:

score: 0
Accepted
time: 53ms
memory: 19704kb

input:

971921829179404410241929619884928254698564607165920347539288855710551811118379220059564976252609095474104047408234988791852885480433214791867282415014752745165915983812277945548897304372538974234963047536038433235954556612423236498585003838058690498411726350277235414196659716714446101495049850320766...

output:

4
5
7
1
1
9
5
9
3
3
1
4
2
1
2
5
9
0
8
2
5
8
2
4
0
8
2
6
1
8
9
2
7
4
5
4
8
9
2
8
6
3
9
9
8
6
8
4
6
8
9
5
2
0
1
0
5
1
0
8
3
2
9
8
1
6
3
6
6
4
4
4
0
5
1
9
2
9
4
9
3
1
0
5
1
8
1
7
6
3
9
7
9
0
0
5
4
1
7
3
0
3
1
4
0
6
1
9
8
1
3
6
7
6
0
8
3
2
3
6
4
7
8
8
0
3
8
6
8
6
6
0
6
6
7
5
2
8
2
0
2
8
8
7
1
0
5
1
3
4
...

result:

ok 49995 numbers

Test #90:

score: 0
Accepted
time: 69ms
memory: 20400kb

input:

476216326660385283019229740763258311544939470566293595406767923549407504834783186114156291172728912895330708735663519169473937511987047679483165363067038795861201065644446544168400252956937422671749765659476957699345108837535725260018421445819800607687302793349962181804311837998856543140634629749145...

output:

0
5
1
5
9
8
4
7
9
3
1
7
7
3
7
4
1
7
8
5
8
7
8
4
4
9
4
6
3
9
7
4
5
0
8
4
1
1
3
8
6
4
8
4
9
4
7
9
5
9
2
9
8
5
2
7
6
6
2
3
0
8
7
5
5
5
1
7
2
9
7
3
2
9
4
3
8
7
9
3
8
9
4
9
1
9
4
0
6
1
8
9
9
8
5
7
8
7
8
3
3
2
9
7
5
3
6
0
2
8
6
8
7
7
4
1
0
3
8
0
4
5
5
9
1
4
2
0
6
3
9
2
3
6
6
2
8
3
9
9
1
1
8
8
3
8
5
5
9
4
...

result:

ok 49985 numbers

Test #91:

score: 0
Accepted
time: 65ms
memory: 19516kb

input:

655342810593882493594599763567760083391944378670676336878141793992784344859484353507774324679073417683022671129049398550765044853949052144144077870305931536282992598884639037563931738820295852484836856673269945718128298647909960090969841982710751343379194125019372237999371785346431331273008394444689...

output:

8
6
5
6
8
8
2
5
0
4
5
0
0
3
6
5
6
1
8
4
4
7
8
9
6
7
9
0
4
0
8
2
2
2
1
1
4
2
4
9
9
3
0
9
4
6
4
9
7
2
5
8
0
4
9
9
4
0
9
8
9
4
0
5
1
7
1
3
2
4
3
8
6
1
0
2
8
2
4
8
7
9
4
5
1
8
9
8
9
9
8
0
2
5
6
2
2
9
5
7
3
0
3
5
0
9
2
9
3
5
5
7
2
9
7
3
7
6
9
8
2
1
0
2
9
7
0
8
2
6
3
2
9
1
3
1
6
4
0
7
3
6
1
3
5
3
5
0
8
9
...

result:

ok 49931 numbers

Test #92:

score: 0
Accepted
time: 70ms
memory: 19588kb

input:

866063608530006200638100224228979483396954235434680565245924113067087355261866471560266093365582510314527313693239120042637730370938758150770031007557273164548771494022275809006503068001196968841684562575827590009961298547949173139740580327181059420328522088943605242494874569968967737830685753407937...

output:

4
7
3
1
5
6
9
3
7
1
9
1
5
0
9
2
1
1
3
6
0
2
0
5
1
3
6
4
2
7
3
2
8
4
2
6
0
0
7
3
2
8
0
8
6
8
3
7
4
5
9
1
3
5
8
6
5
2
7
3
3
6
2
7
3
7
2
3
4
5
0
8
3
7
6
5
1
6
6
1
2
4
5
4
8
0
8
3
2
6
6
3
2
1
6
3
6
5
4
4
0
3
4
7
9
2
2
2
8
5
1
5
0
8
4
1
1
3
4
9
8
5
6
8
7
4
5
1
7
0
7
9
9
5
7
0
3
3
1
7
9
0
4
0
9
9
3
3
4
7
...

result:

ok 50024 numbers

Test #93:

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

input:

1 2
1
2 1

output:

-1

result:

ok 1 number(s): "-1"

Test #94:

score: 0
Accepted
time: 13ms
memory: 3496kb

input:

9 7
100000
2 1
1 1 6
2 1
2 1
1 1 5
2 1
1 1 1
2 1
1 1 6
2 1
1 1 2
2 1
1 1 2
1 1 4
2 1
2 1
2 1
1 1 2
2 1
1 1 8
1 1 4
1 1 6
1 1 6
2 1
2 1
1 1 9
1 1 2
2 1
2 1
1 1 5
1 1 4
2 1
2 1
1 1 8
1 1 6
2 1
1 1 9
1 1 3
1 1 6
2 1
1 1 9
1 1 2
1 1 8
2 1
1 1 9
1 1 9
1 1 7
2 1
2 1
2 1
2 1
2 1
1 1 1
2 1
2 1
2 1
1 1 9
1 1...

output:

9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
...

result:

ok 49912 numbers

Test #95:

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

input:

765391651073083164605572263439541145125119669358887253330635735533581684785186952822060019571347860271797163879028258901331237446209788619970845725612598024828001250590105329503273043583258669612171573556002972963841529495795217465912932928767538007097597888065831109679996101813089054686393043179819...

output:

1

result:

ok 1 number(s): "1"