QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#643778#7954. Special Numbersucup-team3474AC ✓97ms630420kbC++2016.2kb2024-10-16 00:09:232024-10-16 00:09:25

Judging History

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

  • [2024-10-16 00:09:25]
  • 评测
  • 测评结果:AC
  • 用时:97ms
  • 内存:630420kb
  • [2024-10-16 00:09:23]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int N=1919810,mod=1e9+7;
ll n;
string L,R;
int cnt[10];
vector<ll> v;
map<__int128,int> mp;
ll f2[30][2];
ll d2[30][2];
ll f[26][60][40][30][20][2];
ll dp[26][60][40][30][20][2];
int c[10];

ll cal(string s){
    reverse(s.begin(),s.end());
    if(s=="0") return 0;
    s=" "+s;
    memset(d2,0,sizeof d2);
    int sz=s.size()-1;
    ll sum=0;
    for(int i=1;i<sz;i++){
        for(int j=1;j<=9;j++){
            sum+=f2[i-1][1];
            sum%=mod;
        }
    }
    //cout<<sum<<endl;
    d2[sz][1]=sum;
    int state=0;
    for(int i=sz;i>0;i--){
            int tt=s[i]-'0';
        for(int j=0;j<tt;j++){
            if(i==sz&&j==0) continue;
            for(int u=0;u<=1;u++){
                int ns=state|u;
                if(j==0) ns=1;
                d2[i][ns]+=f2[i-1][u];
                d2[i][ns]%=mod;
            }
        }
        if(s[i]=='0') state=1;
    }
    ll ans=0;
    if(state) ans=1;
    for(int i=1;i<=sz;i++){
        //cout<<d2[i][1]<<endl;
        ans=(ans+d2[i][1])%mod;
    }
    //cout<<ans<<endl;
    return ans;
}





string trans(string s){
    //if(!flag) return s;
    __int128 xx=0;
    for(int i=0;i<s.size();i++){
        int t=s[i]-'0';
        xx=xx*10+t;
    }
    xx--;
    string ss;
    while(xx){
        int t=xx%10;
        //cout<<t<<endl;
        char ch=t+'0';
        ss+=ch;
        xx/=10;
    }
    if(ss.size()==0) ss="0";
    reverse(ss.begin(),ss.end());
    //cout<<ss<<endl;
    return ss;
}


void work2(){
    f2[0][0]=1;
    for(int i=1;i<=25;i++){
        for(int j=0;j<=9;j++){
            if(j==0){
                (f2[i][1]+=(f2[i-1][0]+f2[i-1][1]))%=mod;
            }else{
                (f2[i][0]+=f2[i-1][0])%=mod;
                (f2[i][1]+=f2[i-1][1])%=mod;
            }
        }

    }
        //cout<<f2[1][1]<<endl;
    cout<<(cal(R)-cal(trans(L))+mod)%mod<<endl;
}


ll Cal(string s){
    reverse(s.begin(),s.end());
    if(s=="0") return 0;
    s=" "+s;
    memset(dp,0,sizeof dp);
    int sz=s.size()-1;
    ll sum=0;
    ll st2=0,st3=0,st5=0,st7=0,st0=0;


    for(int i=1;i<sz;i++)
    for(int t2=0;t2<=c[1];t2++){
            for(int t3=0;t3<=c[2];t3++){
                for(int t5=0;t5<=c[3];t5++){
                    for(int t7=0;t7<=c[4];t7++){
                        for(int t0=0;t0<=c[0];t0++){
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }

                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2++;
                                nt2=min(nt2,c[1]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt3++;
                                nt3=min(nt3,c[2]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2+=2;
                                nt2=min(nt2,c[1]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt5++;

                                nt5=min(nt5,c[3]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2++;
                                nt3++;
                                nt2=min(nt2,c[1]);
                                nt3=min(nt3,c[2]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt7++;

                                nt7=min(nt7,c[4]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2+=3;
                                nt2=min(nt2,c[1]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt3+=2;
                                nt3=min(nt3,c[2]);
                                if((nt2==c[1]&&nt3==c[2]&&nt5==c[3]&&nt7==c[4])||nt0==c[0])
                                (sum+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }

                        }
                    }
                }
            }
    }
    //cout<<sum<<endl;
    for(int i=sz;i>=1;i--){
        int tt=s[i]-'0';
        for(int j=0;j<tt;j++){
            if(j==0&&i==sz) continue;
            for(int t2=0;t2<=c[1];t2++){
            for(int t3=0;t3<=c[2];t3++){
                for(int t5=0;t5<=c[3];t5++){
                    for(int t7=0;t7<=c[4];t7++){
                        for(int t0=0;t0<=c[0];t0++){
                            if(j==0)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);
                                nt0=1;
                                (dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==1){
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                (dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;

                            }
                            if(j==2)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt2++;
                                nt2=min(nt2,c[1]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==3)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt3++;
                                nt3=min(nt3,c[2]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==4)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt2+=2;
                                nt2=min(nt2,c[1]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==5)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt5++;

                                nt5=min(nt5,c[3]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==6)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt2++;
                                nt3++;
                                nt2=min(nt2,c[1]);
                                nt3=min(nt3,c[2]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==7)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt7++;

                                nt7=min(nt7,c[4]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==8)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt2+=3;
                                nt2=min(nt2,c[1]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            if(j==9)
                            {
                                int nt2=t2+st2,nt3=t3+st3,nt5=t5+st5,nt7=t7+st7,nt0=t0|st0;
                                nt2=min(nt2,c[1]),nt3=min(nt3,c[2]),nt5=min(nt5,c[3]),nt7=min(nt7,c[4]);

                                nt3+=2;
                                nt3=min(nt3,c[2]);(dp[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                        }
                    }
                }
            }
            }


        }
         if(tt==0){
                st0=1;
            }
            if(tt==2){
                st2++;

            }
            if(tt==3){
                st3++;
            }
            if(tt==4){
                st2+=2;
            }
            if(tt==5){
                st5++;
            }
            if(tt==6){
                st2++,st3++;
            }
            if(tt==7){
                st7++;
            }
            if(tt==8){
                st2+=3;
            }
            if(tt==9){
                st3+=2;
            }
    }
    ll ans=0;

    if((st2>=c[1]&&st3>=c[2]&&st5>=c[3]&&st7>=c[4])||st0==c[0]){
        ans++;
        //cout<<"--"<<endl;
    }
    for(int i=1;i<=sz;i++)
    for(int t2=0;t2<=c[1];t2++){
            for(int t3=0;t3<=c[2];t3++){
                for(int t5=0;t5<=c[3];t5++){
                    for(int t7=0;t7<=c[4];t7++){
                        for(int t0=0;t0<=c[0];t0++){
                            if((t2==c[1]&&t3==c[2]&&t5==c[3]&&t7==c[4])||t0==1) (ans+=dp[i][t2][t3][t5][t7][t0])%=mod;
                        }
                    }
                }
            }
    }
    //cout<<ans<<endl;
    return (ans+sum)%mod;
}



void work1(){
    f[0][0][0][0][0][0]=1;
    for(int i=1;i<=25;i++){
        for(int t2=0;t2<=c[1];t2++){
            for(int t3=0;t3<=c[2];t3++){
                for(int t5=0;t5<=c[3];t5++){
                    for(int t7=0;t7<=c[4];t7++){
                        for(int t0=0;t0<=c[0];t0++){

                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt0=1;
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }

                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2++;
                                nt2=min(nt2,c[1]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt3++;
                                nt3=min(nt3,c[2]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2+=2;
                                nt2=min(nt2,c[1]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt5++;

                                nt5=min(nt5,c[3]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2++;
                                nt3++;
                                nt2=min(nt2,c[1]);
                                nt3=min(nt3,c[2]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt7++;

                                nt7=min(nt7,c[4]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt2+=3;
                                nt2=min(nt2,c[1]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                            {
                                int nt2=t2,nt3=t3,nt5=t5,nt7=t7,nt0=t0;
                                nt3+=2;
                                nt3=min(nt3,c[2]);
                                (f[i][nt2][nt3][nt5][nt7][nt0]+=f[i-1][t2][t3][t5][t7][t0])%=mod;
                            }
                        }
                    }
                }
            }
        }
    }

         //cout<<f2[1][1]<<endl;
    cout<<(Cal(R)-Cal(trans(L))+mod)%mod<<endl;
}

signed main()
{
    cin>>n;
    cin>>L>>R;

    ll nn;
    nn=n;
    c[0]=1;
    while(nn%2==0){
        c[1]++;
        nn/=2;
    }

    while(nn%3==0){
        c[2]++;
        nn/=3;
    }

    while(nn%5==0){
        c[3]++;
        nn/=5;
    }

    while(nn%7==0){
        c[4]++;
        nn/=7;
    }

    if(nn==1){
        work1();
    }else{
        work2();
    }



}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 19ms
memory: 589956kb

input:

5 1 20

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 67ms
memory: 589308kb

input:

5 50 100

output:

19

result:

ok single line: '19'

Test #3:

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

input:

15 11 19

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 92ms
memory: 588788kb

input:

1 100 100000

output:

99901

result:

ok single line: '99901'

Test #5:

score: 0
Accepted
time: 35ms
memory: 589412kb

input:

1 1 1

output:

1

result:

ok single line: '1'

Test #6:

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

input:

10 800 43021

output:

23570

result:

ok single line: '23570'

Test #7:

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

input:

1125899906842624 1 100000000000000000000

output:

555058180

result:

ok single line: '555058180'

Test #8:

score: 0
Accepted
time: 67ms
memory: 591236kb

input:

187500000 5941554024261918062 17356601866920567143

output:

679191360

result:

ok single line: '679191360'

Test #9:

score: 0
Accepted
time: 67ms
memory: 591228kb

input:

1555848 157165614890794026 49792374427566422833

output:

588832126

result:

ok single line: '588832126'

Test #10:

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

input:

53814924637488000 8378901287491856069 46225409092942057365

output:

964965504

result:

ok single line: '964965504'

Test #11:

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

input:

11814720750000000 8152927138245188051 35351923956338524619

output:

183963359

result:

ok single line: '183963359'

Test #12:

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

input:

6453888000000 4334845344448208535 35982793193772682339

output:

570114022

result:

ok single line: '570114022'

Test #13:

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

input:

90071357282285400 7893548167754114409 27099084703937108974

output:

869822186

result:

ok single line: '869822186'

Test #14:

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

input:

45571065750000 177160749596350425 98884377930460959454

output:

607698665

result:

ok single line: '607698665'

Test #15:

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

input:

1128443962982400 6338876482181492537 40931938533793596007

output:

881168270

result:

ok single line: '881168270'

Test #16:

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

input:

1 1 1

output:

1

result:

ok single line: '1'

Test #17:

score: 0
Accepted
time: 91ms
memory: 593772kb

input:

1412793457031250 2410155470167050095 99063185266833009818

output:

399813226

result:

ok single line: '399813226'

Test #18:

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

input:

67722117120000 8909573534349989418 73129289758235281558

output:

898227227

result:

ok single line: '898227227'

Test #19:

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

input:

472055808000 6809917603531307093 27494416416722163137

output:

379198478

result:

ok single line: '379198478'

Test #20:

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

input:

19353600000 8687492345912514346 24058039408337150852

output:

250715555

result:

ok single line: '250715555'

Test #21:

score: 0
Accepted
time: 59ms
memory: 592404kb

input:

47855420020225440 6150828649270625443 84863934988301168136

output:

665186711

result:

ok single line: '665186711'

Test #22:

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

input:

1382400000 9545797804645162278 70441077437727026904

output:

278230087

result:

ok single line: '278230087'

Test #23:

score: 0
Accepted
time: 97ms
memory: 603664kb

input:

816293376 2952089614708276156 10939708785225040670

output:

120954190

result:

ok single line: '120954190'

Test #24:

score: 0
Accepted
time: 67ms
memory: 592288kb

input:

4185097875 1348426133484952253 56617823359794500344

output:

773995224

result:

ok single line: '773995224'

Test #25:

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

input:

5828945117184 7777082394971366991 63470232991138132969

output:

678496908

result:

ok single line: '678496908'

Test #26:

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

input:

16184770560 3869053219872876321 94590086601168840932

output:

168181821

result:

ok single line: '168181821'

Test #27:

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

input:

2 1 12

output:

6

result:

ok single line: '6'

Test #28:

score: 0
Accepted
time: 52ms
memory: 590392kb

input:

30146484375 290228705524339176 51853415145287716863

output:

229436627

result:

ok single line: '229436627'

Test #29:

score: 0
Accepted
time: 63ms
memory: 594872kb

input:

2072513819443200 3726664558969607832 42501102605103061370

output:

947952932

result:

ok single line: '947952932'

Test #30:

score: 0
Accepted
time: 91ms
memory: 615672kb

input:

9920232000000000 4602219263214498291 80783137037024823899

output:

846877519

result:

ok single line: '846877519'

Test #31:

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

input:

97200000000000000 9310820760839688870 35322929083473756214

output:

936587432

result:

ok single line: '936587432'

Test #32:

score: 0
Accepted
time: 59ms
memory: 592312kb

input:

45209390625 5752361069878044328 64635325028527078951

output:

578047592

result:

ok single line: '578047592'

Test #33:

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

input:

54442233216000 2452030574225118723 90982734056131320662

output:

417646585

result:

ok single line: '417646585'

Test #34:

score: 0
Accepted
time: 91ms
memory: 609696kb

input:

1530550080000 7431421026778839808 84825282227911272129

output:

600103842

result:

ok single line: '600103842'

Test #35:

score: 0
Accepted
time: 67ms
memory: 607256kb

input:

13765147361280 4924477486471254843 10002324705150566233

output:

951883713

result:

ok single line: '951883713'

Test #36:

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

input:

59825698242187500 6303744363677706767 91410210495502213963

output:

774734375

result:

ok single line: '774734375'

Test #37:

score: 0
Accepted
time: 67ms
memory: 603808kb

input:

110658879959040 2133591391458550040 48494371567095341228

output:

103505650

result:

ok single line: '103505650'

Test #38:

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

input:

1 3 100

output:

98

result:

ok single line: '98'

Test #39:

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

input:

3160365465600 8968721517098518892 78444481529635953131

output:

364620926

result:

ok single line: '364620926'

Test #40:

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

input:

54838448056132899 4242999884713464056 92948071680698209741

output:

922087167

result:

ok single line: '922087167'

Test #41:

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

input:

78183771565555182 7823307199080715671 93466469990450000599

output:

635073629

result:

ok single line: '635073629'

Test #42:

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

input:

56555532446322947 2952925229100796893 35926880503684324113

output:

663547216

result:

ok single line: '663547216'

Test #43:

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

input:

15701121272683095 8633703383009071570 55273589042372583668

output:

253996413

result:

ok single line: '253996413'

Test #44:

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

input:

11914467542453704 2857068399817941722 83230805830740136213

output:

956698341

result:

ok single line: '956698341'

Test #45:

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

input:

28181999963152819 7948365158338416594 87742700746768593189

output:

720016372

result:

ok single line: '720016372'

Test #46:

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

input:

85409868208332321 3921672860136397259 55474188860042435613

output:

622329181

result:

ok single line: '622329181'

Test #47:

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

input:

14748052718175068 9293071633738211123 85443373435217434149

output:

38392129

result:

ok single line: '38392129'

Test #48:

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

input:

41002058985303228 6141335647135876923 78910335860595680506

output:

665823537

result:

ok single line: '665823537'

Test #49:

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

input:

4 3 123

output:

62

result:

ok single line: '62'

Test #50:

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

input:

100000000000000000 3 100000000000000000000

output:

302574822

result:

ok single line: '302574822'

Test #51:

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

input:

6 7 12034

output:

9505

result:

ok single line: '9505'

Test #52:

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

input:

7 8 43021

output:

25028

result:

ok single line: '25028'

Test #53:

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

input:

8 8 43021

output:

32619

result:

ok single line: '32619'

Test #54:

score: 0
Accepted
time: 63ms
memory: 590576kb

input:

9 800 43021

output:

30930

result:

ok single line: '30930'