#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <complex>
using namespace std;

bool overflow;

void checkOverflow(complex<int> a)
{
    if(a.real() < -10000 || a.real() > 10000 || a.imag() < -10000 || a.imag() > 10000)
        overflow = true;
}

complex<int> readSum(string&, int&);

complex<int> readProduct(string& s, int& i)
{
    int n = s.size();

    complex<int> ret(1, 0);
    for(;;){
        complex<int> a;
        if(s[i] == 'i'){
            a = complex<int>(0, 1);
            ++ i;
        }else if('0' <= s[i] && s[i] <= '9'){
            while(i < n && '0' <= s[i] && s[i] <= '9'){
                a *= 10;
                a += s[i] - '0';
                ++ i;
                checkOverflow(a);
            }
        }else{
            ++ i;
            a = readSum(s, i);
            ++ i;
        }
        ret *= a;
        checkOverflow(ret);

        if(i < n && s[i] == '*')
            ++ i;
        else
            return ret;
    }
}

complex<int> readSum(string& s, int& i)
{
    int n = s.size();

    complex<int> ret = complex<int>(0, 0);
    bool add = true;
    for(;;){
        complex<int> a = readProduct(s, i);
        if(add)
            ret += a;
        else
            ret -= a;
        checkOverflow(ret);

        if(i < n && s[i] == '+')
            add = true;
        else if(i < n && s[i] == '-')
            add = false;
        else
            return ret;
        ++ i;
    }
}

int main()
{
    for(;;){
        string s;
        if(!(cin >> s))
            return 0;

        overflow = false;
        int i = 0;
        complex<int> ret = readSum(s, i);

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