using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public int a { get; set; }
    public int b { get; set; }
    public string c { get; set; }
}

public class hello
{
    public static bool OF;
    static void Main()
    {
        string T;
        for (; (T = Console.ReadLine()) != null;)
        {
            OF = false;
            var line = change(T.Trim());
            var q = conv(line);
            if (OF) { Console.WriteLine("overflow"); goto exit; }
            var p = getAns(q);
            if (p.a == int.MaxValue) Console.WriteLine("overflow");
            else
            {
                if (p.a == 0)
                {
                    if (p.b > 0) Console.WriteLine("{0}i", p.b);
                    else if (p.b < 0) Console.WriteLine("-{0}i", -p.b);
                    else Console.WriteLine(0);
                }
                else
                {
                    if (p.b > 0) Console.WriteLine("{0}+{1}i", p.a, p.b);
                    else if (p.b < 0) Console.WriteLine("{0}-{1}i", p.a, -p.b);
                    else Console.WriteLine("{0}", p.a);
                }
            }
        exit:;
        }
    }
    static bool IsOverFlow(P a) => a.a > 10000 | a.a < -10000 | a.b > 10000 | a.b < -10000;
    static P getAns(Queue<P> q)
    {
        var st = new Stack<P>();
        while (q.Count() > 0)
        {
            var w = q.Dequeue();
            if (w.c == "+")
            {
                var a1 = st.Pop();
                var a2 = st.Pop();
                var a3 = new P { a = a1.a + a2.a, b = a1.b + a2.b };
                if (IsOverFlow(a3)) return new P { a = int.MaxValue };
                else st.Push(a3);
            }
            else if (w.c == "-")
            {
                var a1 = st.Pop();
                var a2 = st.Pop();
                var a3 = new P { a = a2.a - a1.a, b = a2.b - a1.b };
                if (IsOverFlow(a3)) return new P { a = int.MaxValue };
                else st.Push(a3);
            }
            else if (w.c == "*")
            {
                var a1 = st.Pop();
                var a2 = st.Pop();
                var a3 = new P { a = a1.a * a2.a - a1.b * a2.b, b = a1.a * a2.b + a2.a * a1.b };
                if (IsOverFlow(a3)) return new P { a = int.MaxValue };
                else st.Push(a3);
            }
            else st.Push(w);
        }
        return st.Pop();
    }
    static string zerocut (string s)
    {
        var p = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] != '0') { p = i; break; }
        }
        return s.Substring(p);
    }
    static Queue<P> conv(List<string> line)
    {
        var q = new Queue<P>();
        var st = new Stack<P>();
        foreach (var x in line)
        {
            if (x == "(") st.Push(new P { c = x });
            else if (x == "+" | x == "-")
            {
                if (st.Count() == 0) st.Push(new P { c = x });
                else
                {
                    if (st.Peek().c == "*")
                    {
                        q.Enqueue(st.Pop());
                        if (st.Count() > 0 && (st.Peek().c == "+" | st.Peek().c == "-")) q.Enqueue(st.Pop());
                        st.Push(new P { c = x });
                    }
                    else if (st.Peek().c == "+" | st.Peek().c == "-")
                    {
                        q.Enqueue(st.Pop());
                        st.Push(new P { c = x });
                    }
                    else if (st.Peek().c == "(") st.Push(new P { c = x });
                }
            }
            else if (x == "*")
            {
                if (st.Count() == 0) st.Push(new P { c = x });
                else
                {
                    if (st.Peek().c == "*")
                    {
                        q.Enqueue(st.Pop());
                        st.Push(new P { c = x });
                    }
                    else if (st.Peek().c == "+" | st.Peek().c == "-") st.Push(new P { c = x });
                    else if (st.Peek().c == "(") st.Push(new P { c = x });
                }
            }
            else if (x == ")")
            {
                while (true)
                {
                    if (st.Peek().c == "(") { st.Pop(); break; }
                    else q.Enqueue(st.Pop());
                }
            }
            else if (x == "i") q.Enqueue(new P { b = 1 });
            else
            {
                var x2 = zerocut(x);
                if (x2.Length >= 6) { OF = true; return q; }
                var tt = int.Parse(x);
                if (tt > 10000 | tt < -10000) { OF = true; return q; }
                else q.Enqueue(new P { a = int.Parse(x) });
            }
        }
        while (st.Count() > 0)
        {
            q.Enqueue(st.Pop());
        }
        return q;
    }
    static List<string> change(string s)
    {
        s = s.Replace("+", " + ");
        s = s.Replace("-", " - ");
        s = s.Replace("*", " * ");
        s = s.Replace("(", "( ");
        s = s.Replace(")", " )");
        return s.Split(' ').ToList();
    }
}


Measured memory_bytes: 16732