#include <iostream>
#include <cctype>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <complex>
using namespace std;

char e[1000];

typedef long long ll;
typedef complex<ll> C;

inline bool valid(C x){
    ll t = max(abs(x.real()),abs(x.imag()));
    return t <= 10000;
}

class OverFlow {};

C expr(char* &p);
C term(char* &p);
C fact(char* &p);
C num(char* &p);

inline bool ispm(char c){
    return c=='+' || c=='-';
}
inline bool ispd(char c){
    return c=='*' || c=='/';
}

C num(char* &p){
    C res = 0;
    if(isdigit(*p) || *p == 'i'){
        ;
    }else{
        throw "num begin";
    }
    if(isdigit(*p)){
        while (isdigit(*p)){
            res*=10;
            res+=*p-'0';
            if(!valid(res)) throw OverFlow();
            p++;
        }
    }else{
        res = C(0,1);
        p++;
    }

    if(*p=='\0' || *p==')' || ispm(*p) || ispd(*p)){
        ;
    }else{
        throw "num end";
    }

    if(!valid(res)) throw OverFlow();
    return res;
}

C fact(char* & p){
    C res = 0;
    if(*p=='(' || isdigit(*p) || *p == 'i'){
        ;
    }else{
        throw "fact begin";
    }

    if(*p=='('){
        p++;
        res += expr(p);
        p++;
    }else if(isdigit(*p) || *p == 'i'){
        res += num(p);
    }
    if(*p=='\0' || *p==')' || ispm(*p) || ispd(*p)){
        ;
    }else{
        cout << p-e << endl;
        throw "fact end";
    }

    if(!valid(res)) throw OverFlow();
    return res;
}

C term(char* & p){
    C res;
    if(*p=='(' || isdigit(*p) || *p == 'i'){
        res = fact(p);
    }else{
        throw "term begin";
    }
    while(1){
        if(*p=='*'){
            p++;
            res *= fact(p);
            if(!valid(res)) throw OverFlow();
        }else if(*p=='/'){
            p++;
            res /= fact(p);
            if(!valid(res)) throw OverFlow();
        }else if(*p=='\0' || *p==')' || *p=='+' || *p=='-'){
            break;
        }else{
            throw "term end";
        }
    }

    if(!valid(res)) throw OverFlow();
    return res;
}

C expr(char* & p){
    C res;
    if(*p=='(' || isdigit(*p) || *p == 'i'){
        res=term(p);
    }else{
        throw "exp begin";
    }

    while(1){
        if(*p=='+'){
            p++;
            res += term(p);
        }else if(*p=='-'){
            p++;
            res -= term(p);
        }else if(*p=='\0' || *p==')' || ispm(*p) || ispd(*p)){
            break;
        }else{
            throw "exp end";
        }
        if(!valid(res)) throw OverFlow();
    }

    return res;
}

void print(C c){
    int a=c.real(), b=c.imag();
    if(a==0 && b==0) cout << 0 << endl;
    else if(a==0) cout << b << "i" << endl;
    else if(b==0) cout << a <<endl;
    else if(b>0) cout << a << "+" << b << "i" << endl;
    else cout << a << b << "i" << endl;
}

int main(){
    while(cin>>e){
        try {
            char* p = e;
            print(expr(p));
        } catch(const OverFlow e){
            cout << "overflow" << endl;
        }
    }
}