#include<bits/stdc++.h>
using namespace std;
char op;
double a1,b1,a2,b2;
void solve(){
cin>>a1>>b1>>a2>>b2>>op;
if(op=='+'){
printf("%.1f %.1f",a1+a2,b1+b2);
}else if(op=='*'){
printf("%.1f %.1f",a1*a2-b1*b2,a1*b2+a2*b1);
}
}
int main(){
solve();
return 0;
}