#include <iostream>
#include <string>
#include <complex>
#include <map>
#include <cassert>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef pair<complex<ll>,int> pvalue;
pvalue expression(string &s,int pos=0);
pvalue factor(string &s,int pos=0);
pvalue inner(string &s,int pos=0);

bool overflow;

ll kabs(ll a) {
    return (a>0)?a:-a;
}

pvalue expression(string &s,int pos) {
    pvalue pv = factor(s,pos);
    pos = pv.second;
    while(pos < s.length() && (s[pos] == '+' || s[pos] == '-')) {
        pvalue p2 = factor(s,pos+1);
        if(s[pos] == '+') pv.first += p2.first;
        else pv.first -= p2.first;
        pos = p2.second;
        if(kabs(pv.first.real()) > 10000 || kabs(pv.first.imag()) > 10000)
            overflow = true;
    }
    pv.second = pos;
    return pv;
}

pvalue factor(string &s,int pos) {
    pvalue pv = inner(s,pos);
    pos = pv.second;
    while(pos < s.length() && s[pos] == '*') {
        pvalue p2 = inner(s,pos+1);
        pv.first *= p2.first;
        pos = p2.second;
        if(kabs(pv.first.real()) > 10000 || kabs(pv.first.imag()) > 10000)
            overflow = true;
    }
    pv.second = pos;
    return pv;
}

pvalue inner(string &s,int pos) {
    if(s[pos] == '(') {
        pvalue pv = expression(s,pos+1);
        assert(s[pv.second] == ')');
        return make_pair(pv.first,pv.second+1);
    }

    bool readchar = false;
    complex<int> r(0,0);
    while(isdigit(s[pos])) {
        r *= 10;
        r += s[pos] - '0';
        pos++;
        readchar = true;
        if(kabs(r.real()) > 10000 || kabs(r.imag()) > 10000) {
            overflow = true;
            r = complex<ll>(0,0);
        }
    }
    if(s[pos] == 'i') {
        if(!readchar) r = complex<ll>(1,0);
        r *= complex<ll>(0,1);
        pos++;
    }
    if(kabs(r.real()) > 10000 || kabs(r.imag()) > 10000)
        overflow = true;

    return make_pair(r,pos);
}

int main() {
    string s;
    while(cin>>s) {
        overflow = false;
        pvalue p = expression(s);
        if(overflow) {
            cout<<"overflow"<<endl;
        }else{
            if(p.first.real() != 0) cout<<p.first.real();
            if(p.first.imag() > 0 && p.first.real() != 0) cout<<'+';
            if(p.first.imag() != 0) {
                cout<<p.first.imag();
                cout<<"i";
            }
            if(p.first.real() == 0 && p.first.imag() == 0) cout<<"0";
            cout<<endl;
        }
    }
}