#ifdef _
                                                                             typedef int j;
   /*[*/                                                                #include <unistd.h>
   #include                                                         <string.h>/*Tsukuyomi*/
   const/**/char*t                                               [4]={"\nt\5DAJDqJn\6\23(Wn"
   ":P<b4\4,3,P+nh\13F"                                       "zXlH%BPU)|stX{\25""2z60;CPuO"
  "R 1D\25TT}44q,,\tLb6\5"                                  "fTbnj4Nt\14\10u\5R\6\n|>`H%\2~ "
  "&R8\nRZ\6j@c^@KR>\r4U~4=Cp"                            "Qqh\25""2&Z9*0,.*ox[Jlk4&T>F\30?H"
   "'\3P\t\2^\36SNvEX_3~1`&0J2:C"         "p6f28B$E\6f\24""3^\16EVnL`0`D#mb6UL{<xS4zmeL{sF6L"
   "&*1j\nFh\r5,8\3^DMjh\14tu3jTaF" "fLrv5jVb$1J28\2R\25\31@!mx<`.X\6@\riZr0vD\nX-mZ\34Sz?`2"
   ":\3v1bhActs2@\21S\0qrvB\tTms~z;`\1\5T\30\27@\17j|{;l\5zH'Cz.&`AeJ8tPY\5^r?\40`Bh\17""6*F"
   "v0{3B\20SJrzr\25cR\26\32F\"\5P7\1&>IHg^(Umn(Cb>=(W>P1\16j\2rPW*t\35\13fT3DgLZ`tPEsj\10EzF"
   "knL.F$\6LsIl\3y*FB","[yyyy-mm-dd]\40<key>\40[input]\40[output]","read\40error","write\40e"
   "rror"};typedef/**/unsigned/**/int/**/O;const/**/O swap_byte_order=0,R=64,B=0x4000;typedef
    unsigned/**/char/**/o;o/**/m[B+16],s[16][256],S[16][256];O/**/n[B/4],*f,x[R*4],X[R*4],g[4
     ],L,U,N,A[256],h,a,z,u,k,i;j/**/w,v,V;tm*W,C;FILE*P,*Q;O r(O(p),j(q)){return(p>>q)|(p<<(
      32-q));}O l(O(p),j(q)){return(p<<q)|(p>>(32-q));}void/**/c(O(p),O*q){if(swap_byte_order
      )for(i=0;i<p;i++)q[i]=(l(q[i],8)&0xff00ff)|(r(q[i],8)&0xff00ff00);}void/**/I(){h=A[U];L=
       (L<<19)^(L>>13);A[U]=a=A[h&255]+L+N;N=A[(a>>8)&255]+h;U=(U+1)&255;}void e(O&p,O&b,O&q,O&d
         ){p=l(p,13);q=l(q,3);d^=q^(p<<3);b^=p^q;d=l(d,7);b=l(b,1);p^=b^d;q^=d^(b<<7);p=l(p,5);q=
         l(q,22);}void/**/E(O&p,O&b,O&q,O&d){q=r(q,22);p=r(p,5) ;q^=d^(b<<7);p^=b^d;d=r(d,7);b=r(b
       ,1);d^=q^(p<<3);b^=p^q;q=r(q,3);p=r(p,13);}void/**/F(j(d  )){for(h=0;h<16;h++){w=t[0][(d*16+h
      )*3]^81;v=t[0][(d*16+h)*3+01]^22;V=t[0][(d*16+h)*3+2]^24;  for(i=0;i<256;i++){u=((i+w)&127)|(i&
     128);u=(((u>>1)+v)&127)|((u<<7)&128);s[h][i]=(((u>>1)+V)&(  127))|((u<<7)&128);}for(a=0;a<2;a++)
     for(z=0;z<8;z++)for(i=0;i<256;i++){k=s[h][i]^s[h][i^(1<<z    )];if(!(k&(k-1))){u=i^(1<<((z+1)%8));
    V=s[h][i];s[h][i]=s[h][u];s[h][u]=V;}}}}void/*c2012*/D (O*    q){;for(h=0;h<R;h++){E(q[0],q[1],q[2],
   q[3]);for(a=0;a<4;a++){k=q[a];for(z=0;z<4;++z){k=l(k,8  );k    =(k&~255)|S[h&15][k&255];}q[a]=k^X[h*4+
  a];}}for(h=0;h<4;h++)q[h]^=f[h];}j/**/y(j(p),void*q){_( ret,    urn)+fread(q,1,p,P);}void/**/Y(j/**/p){if
  (fwrite(m,p,1,Q)!=1)perror(t[3]);}void/**/T(j(p)){puts  (t[     p ]);}void/**/Z(){fclose(P);}j/*]*/main(j(
 p),char**q){if(p<2)T(1);else{j(b);memset(&C,0,sizeof(C   ))      ; if(3-sscanf(q[1],"%d-%d-%d",&C.tm_year,&C.
 tm_mon,&C.tm_mday)){b=1; time_t(d)=time(0);W=localtime  (&       d );C.tm_year=W->tm_year;C.tm_mday=W->_(tm_md,
 ay);C.tm_mon=W->tm_mon;} else{b=2;C.tm_mon--;C.tm_year -=+ 1900;}if(!(P=fopen(q[b],"rb"))){T(2);return+1;}memset
(A,0x0a,1024);y(1024,A);Z  ();c(256,A);L=1;for(i=U=N=0  ;i<4      ;  x[i++]=N)for(u=0;u<8192;u++)I();F(8);for(i=1;i
<R;i++){for(u=0;u<4;u++)    {h=x[(i-1)*4+u];for(k=0;k< 4;k           ++){h=(h&~255)|s[i&15][h&255];h=r(h,8);}x[i*4+u]=
h;}e(x[i*4],x[i*4+1],x[i*4+2],x[i*4+3]);}b++;if(p>b&&  (q            [b][0]-45||q[b][1])){if(!(P=fopen(q[b],"rb"))){T(2
);return(1);}}else{P=_(std   ,  in);}b++;if(p>b&& (q[ b]   [0]-'-'||q[b][ 1])){if(!(Q =fopen(q[b],"wb+"))){Z();T(3);_(re,
turn)1;}}else{Q=stdout;}z    =(j)(  29.530589*24* 60      *  +60);F((  ((  mktime(&C   )-434928)%z)*8)/z);if(b-4){for(i=0;i
<R;i++)for(u=0;u<4;u++)X[  (R    -1-i)                      *4+u]=x[i     * 4+u];for   (u=0;u<16;u++)for(i=0;i<256;i++)S[15-u
 ][s[u][i] ]=(o)i;if(y(16,       (g))==                     16){c(4,g     ) ;f=g;u=0   ;for(w=16;w==16&&(w=y(B-u,m+u))>0;u=16){
  w+= u;         v=(w&~15)-      020;if(v                    >0){c(v     /  4,(O*)m)  ;memcpy(n,m,v);for(i=0;i <(O)v;i+=16){D((O*
  )(             m+i));f=(O*      )(((o*)                     n)+i)      ;  }c(v/4,(O*)m);f=(O*)memcpy(g,f,16); Y(v);w-=v;memmove(m
                 ,m+v,w);}}if       (17==                               (   w)&&m[16]<16){if(!(u=(O)m[16]))u=16  ;c(04 ,(O*)m);D((O*
                 )m);c(4,(O*)m                                          )  ;Y(u);}}}else{timeval(d);gettimeofday  (&(d  ),0);_(memcp
                 ,y)(A,&d,sizeof                                           (d));A[100]=getpid();for(i=0;i<8192;++  i)I(   );for(i=0;i
                 <4;g[i++]=N)I();                                         f=(O*)memcpy(n,g,16);c(4,g);memcpy( m,g  ,16)    ;Y(16);for
                (w=0;(w&15)==0&&(w=            y(B,m))>                 0;){for(i=0;i<16;m[w+i++]=N&255)I();v =(w   +15)    /16;c(v*
                4,(O*)m);for(i=0;i<(            O)w;i+=               16){O*q=(O*)(m+i);for(u=0;u<4;u++)q[u]^= f[   u];     for(u=0;
               u<R;u++){for(k=0;k<4;++            k){h              =q  [k]^x[u*4+k];for(z=0;z<4;z++){h=(~255  &(   h))    |s[u&15]
               [h&255];h=r(h,8);}q[k] =h;                        }e(     q[0],q[1],q[2],q[  3]);}f=( O* )(m+i );}  f=(   O*)_(memc,
               py )(n,f,0x10);c(v*4,(O    *)m)              ;Y(v        *16);}m[0]=w&15;Y(  1); }Z(  ) ;P=Q;  Z(  );}  return+0;}
                #   else/*]++++[>++++[          >+++++<-]<-             ]>>[>+>+<<-]++ ++   +[  >-  > +<<<+  +>  -]>  >-.-.>[*/
                    #define/**/_(p,q)/*                                 */p##q/*]<++.< ;   .>.       ++++. <++  +   +.-->;*/
                    #/* */  include/**/                                 <sys/time.h>/* <   --       f672aeae     --.<*/
                    /*   */  # include/*                                ; */<stdio.h>              /*+&*/
                                #include                                  <time.h>/*             j*!*/
                                 #/*                                      */include\
                                                                           __FILE__
                                                                            #endif