#pragma GCC optimize("Ofast") #pragma GCC target("avx2") typedef unsigned long ulong; #define RSIZE (1<<19) char rbuf[RSIZE+1]; int main(){ int rlast=0; if(read(0,rbuf,RSIZE)=48); ulong res=0; do{ if(rlast){ if(!*rp){ break; } }else{ long d=rbuf+RSIZE-rp; if(d<24){ memcpy(rbuf,rp,d); rp=rbuf; int nr=read(0,rbuf+d,RSIZE-d); if(nr==0){ break; } if(d+nr!=RSIZE){ rbuf[d+nr]=0; rlast=1; } } } ulong a=0; for(int c;c=*rp++-48,c>=0;)a=a*10+c; res+=a; }while(*rp); char wbuf[64],*wp=wbuf+sizeof wbuf; ulong _z=res; do*--wp=_z%10+48;while(_z/=10); write(1,wp,wbuf+sizeof wbuf-wp); _exit(0); }