#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using C = complex<int>;

string s;
int N;
int c;
bool ok;

bool check(C x){
	return abs(x.real()) <= 10000 && abs(x.imag()) <= 10000;
}

C expr();
C term();
C factor();
C num();

void debug(string text){
	return;
	cout << text + " ";
	for(int i = 0; i < N; i++){
		if(i == c) cout << '[' << s[i] << ']';
		else cout << s[i];
	}
	cout << endl;
}

C expr(){
	debug("expr");
	C x = term();
	while(c < N){
		if(s[c] == '+'){
			c++;
			x += term();
			if(!check(x)){
				ok = false;
			}
		}
		else if(s[c] == '-'){
			c++;
			x -= term();
			if(!check(x)){
				ok = false;
			}
		}
		else break;
	}
	return x;
}

C term(){
	debug("term");
	C x = factor();
	if(!check(x)){
		ok = false;
	}
	while(c < N){
		if(s[c] == '*'){
			c++;
			x *= factor();
			if(!check(x)){
				ok = false;
			}
		}
		else break;
	}
	return x;
}

C factor(){
	debug("factor");
	if(s[c] == '('){
		c++;
		C ret = expr();
		assert(s[c] == ')');
		c++;
		return ret;
	}
	return num();
}

C num(){
	debug("num");
	C ret = 0;
	bool minus = false;
	if(s[c] == '-'){
		minus = true;
		c++;
	}
	if(s[c] == 'i'){
		ret = C(0, 1);
		c++;
	}
	else{
		while(c < N && isdigit(s[c])){
			ret = ret * 10 + (s[c] - '0');
			if(!check(ret)){
				ok = false;
			}
			c++;
		}
	}
	if(minus) ret *= -1;
	return ret;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	while(cin >> s){
		N = s.size();
		c = 0;
		ok = true;
		C ans = expr();

		if(ok){
			if(ans == 0){
				cout << 0;
			}
			else{
				if(ans.real() != 0){
					cout << ans.real();
				}
				if(ans.imag() != 0){
					if(ans.real() != 0 && ans.imag() > 0) cout << "+";
					cout << ans.imag() << "i";
				}
			}
			cout << endl;
		}
		else{
			cout << "overflow" << endl;
		}
	}
}