char
        /******____
       */*_=__FILE__"_`";
      #/*        ,c2005__***/include    <stdio.h>
     /**        ,*/typedef/**/int N;struct{N y,a,u,_,n;}__   ,o[1<<
     16]       ;N E,K,O[1<<16],z=46340,n,a,t,s,u,m,i;typedef void D/*.
     **/   ;D p(N r){putchar(r);}D q(N c,char*r){printf(r,    c);}D Y(N
     r){if   (o[t].a>o[n].a+o[u].a){o[t].y=r;o[t].a=o[o[t].       u=n].a
    /****   */+o[o[t].n=u].a;o[o[t]._<z?t:(O[E++]=t)]._=m;}           ;}D
 Q(   /**/N c);D P(N c,N r){;c=(o[c].y&r)?(Q(c),0):(p(40),Q(            c),
p(     /***/41),0);}D Q(N c){c=(o[c].y-1)?(o[c].y&6)?P(o[c].               u,
 3)   ,(/****/o[c].y-2?(p(47),(o[c].n-s?(p(40),Q(o[c].n),p(41                ),
   0):(Q(s)/***/,0))):(p(42),P( o[c].n,7),0)):(Q(o[c].u),(o[c                ].y
    -8?(p(45),/**/P(o[c].n,7 ), 0) : (p( 43),Q(o[c].n),0))):(q            (s,
   "%d"),0);}D d(N c){if(c>  (z-  1)* (z  -1 ))  {q(s,"%d*(");       d(c/s
  );p(41);if(c%s){{;}p(  +43 -0);  p/*  `     +\  */(40);Q(c%s     );p(41
  );}}else{if(c<z){Q(c  );}else/*    `+_`*/{n=c;u  =0;for(i=2;   i<=(a=c/
  i);i++){if(a<z){if(n >(m=o[i  ]      .  a+o[a].  a+o[c%i].a)) {  n  =m;
   u=i;}}}P(u,3);p(42)   ;P(c/            u,7);if  (c%u){p(43);Q    (c  %u
    );}}}}N main(int c   ,char            **r){if   (c>1){for(t       =i  =0
      ;*_;t +=(N)*(_++)   );++              s;++    K;for(s=03+         (   t
       %+  247);i<z;i++                             )o[i].a=o[i]         ._   =
      z    ;o[o[0].a=o[s]                          .u=o[s].n=o[s]          .   _=
    m=     0].y=16;for(o[0        ]._=            o[s].a=E=K=o[o[           0    ]
   .      u =o[0].n=O[0]=s].y                  =1; E<z-1;K=E){for(           ++    m
  ,     i= 0 ;i<K;){a=0;for(n=O[i          ++];    a<K;){if((t=n*(            u=  O[
  a    ++ ]   ))<z)Y(2);if(!(n%  u)){t=n/u;       Y(4);}if( (t=n+u)            <z
  )    Y (    8);if((t=n-u)>1)Y(                16);}}}K=1  ;for(;K         ++<c
   ;  p ((     m <0)?(p (45),p(40             ),d(-m),p(     41),10)   :(d(m),10)
   ) ) {;         sscanf (*(++r) ,          /*'   */         "%d",&m);q(m,"%d\40="
    " "           );    } };   {;}                             return+0;}