#include <cctype>
#include <iostream>
#include <string>
#include <complex>
using namespace std;
typedef string::iterator S;
complex<int> explession(S& it);

bool overflow;

complex<int> number(S& it) {
	if (*it == 'i') {
		++it;
		return complex<int>(0, 1);
	}
	int n = 0;
	while (isdigit(*it)) {
		n *= 10;
		n += (*it) - '0';
		overflow = overflow || (abs(n) > 10000);
		++it;
	}
	if (*it == 'i') {
		++it;
		return complex<int>(0, n);
	}
	else {
		return complex<int>(n, 0);
	}
}

complex<int> factor(S& it) {
	if (*it == '(') {
		++it;
		complex<int> result = explession(it);
		++it;
// 		cout << result << endl;
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
		return result;
	}
	else {
		complex<int> result = number(it);
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
		return result;
	}
}

complex<int> term(S& it) {
	complex<int> result = factor(it);
	while (*it == '*') {
		++it;
		complex<int> x = factor(it);
		result *= x;
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
	}
// 	cout << result << endl;
	return result;
}

complex<int> explession(S& it) {
	complex<int> result = term(it);
	while (*it == '+' || *it == '-') {
		char op = *it++;
		complex<int> x = term(it);
		if (op == '+') {
			result += x;
		}
		if (op == '-') {
			result -= x;
		}
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
	}
// 	cout << result << endl;
	return result;
}

int main() {
	string str;
	while (cin >> str) {
		string::iterator it = str.begin();
		overflow = false;
		complex<int> c = explession(it);
		if (overflow) {
			cout << "overflow" << endl;
		}
		else if (c == complex<int>(0, 0)) {
			cout << 0 << endl;
		}
		else {
			if (c.real() != 0) {
				cout << c.real();
				if (c.imag() > 0) {
					cout << '+';
				}
			}
			if (c.imag() != 0) {
				cout << c.imag();
				cout << 'i';
			}
			cout << endl;
		}
	}
}