char n[100010]; l;i;f; long long r1,r2; m1=1e9; m2=1e9+7; main(){ gets(n); l=strlen(n); for(i=0;i<(l+1)/2;++i){ r1=(r1*10+n[i]-48+(i>0||l%2==0)*9)%m1; r2=(r2*10+n[i]-48+(i>0||l%2==0)*9)%m2; f|=n[(l+1)/2-i-1]>n[l/2+i]; } if(f){ r1=(r1+m1-1)%m1; r2=(r2+m2-1)%m2; } printf("%d\n",r1); printf("%d\n",r2); }