#include
typedef struct{double a;double b;}data;
int main()
{
data x,y;
int n;
char op;
while(scanf("%d",&n)!=EOF)
{
while(n--)
{
scanf(" ( %lf %lf i ) %c ( %lf %lf i ) ",&x.a,&x.b,&op,&y.a,&y.b);
switch(op)
{
case '+':printf("%.2f%+.2fi\n",x.a+y.a,x.b+y.b);break;
case '-':printf("%.2f%+.2fi\n",x.a-y.a,x.b-y.b);break;
default:break;
}
}
}
return 0;
}
#include
int main()
{ struct comp
{ float re,im;
} a,b;
int n;
char c;
scanf("%d%*c",&n);
while(n--)
{ scanf("(%f%fi)%c(%f%fi)",&a.re,&a.im,&c,&b.re,&b.im);
if(c=='+')
{ a.re+=b.re;
a.im+=b.im;
}
if(c=='-')
{ a.re-=b.re;
a.im-=b.im;
}
printf("%.2f%+-.2fi\n",a.re,a.im);
fflush(stdin);
}
return 0;
}