#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);}) #define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) #define WTHI(v) {unsigned _z=v,_n=0;ulong _d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;} #define WTLO(v) {unsigned _z=v,_n=8;ulong _d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(ulong*)wp=_d;wp+=8;} #define wt(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);} #define rep3(v,s,e) for(typeof(e) v=s;v>=1){ if(j&1){ y=y*a%MD; } a=a*a%MD; } z+=y; } z%=MD; wt(z); *wp++='\n'; } write(1,wbuf,wp-wbuf); _exit(0); }