### constant

MAX_VAL =  10000
MIN_VAL = -10000

### subroutines

### <exp>  := <term> (('+'|'-') <term>)*
### <term> := <elm> ('*' <elm>)*
### <elm>  := '('<exp>')' | <num> | 'i'

def exp()
  res = term()
  return nil if res.nil?

  while $exp[$pos] == '+' || $exp[$pos] == '-'
    op = $exp[$pos]
    $pos += 1

    res0 = term()
    return nil if res0.nil?

    if op == '+'
      res[0] += res0[0]
      res[1] += res0[1]
    else
      res[0] -= res0[0]
      res[1] -= res0[1]
    end
    return nil if
      res[0] > MAX_VAL || res[0] < MIN_VAL ||
      res[1] > MAX_VAL || res[1] < MIN_VAL
  end

  res
end

def term()
  res = elm()
  return nil if res.nil?

  while $exp[$pos] == '*'
    $pos += 1

    res0 = elm()
    return nil if res0.nil?

    rr = res[0] * res0[0] - res[1] * res0[1]
    ri = res[0] * res0[1] + res[1] * res0[0]
    return nil if rr > MAX_VAL || rr < MIN_VAL || ri > MAX_VAL || ri < MIN_VAL

    res = [rr, ri]
  end

  res
end

def elm()
  if $exp[$pos] == '('
    $pos += 1
    res = exp()
    return nil if res.nil?
    $pos += 1
    return res
  elsif $exp[$pos] == 'i'
    $pos += 1
    return [0, 1]
  else
    num = 0
    while /[0-9]/ =~ $exp[$pos]
      num = num * 10 + $exp[$pos].ord - '0'.ord
      $pos += 1
    end
    return [num, 0]
  end
end

def cn2s(cn)
  return 'overflow' if cn.nil?
  return cn[0].to_s if cn[1] == 0
  return sprintf("%d+%di", *cn) if cn[1] > 0
  return sprintf("%d%di", *cn)
end

### main

while line = gets
  $exp = line.strip
  $pos = 0

  ans = exp()
  puts cn2s(ans)
end