#include <bits/stdc++.h>
using namespace std;
string s;
bool overflow = false;
pair<int, int> num(int i) {
  int ret = 0;
  while ('0' <= s[i] && s[i] <= '9') {
    int x = s[i] - '0';
    ret = 10 * ret + x;
    i++;
  }
  return make_pair(i, ret);
}
pair<int, int> multiplication(pair<int, int> a, pair<int, int> b) {
  return pair<int, int>(a.first * b.first - a.second * b.second,
                        a.first * b.second + a.second * b.first);
}
pair<int, int> addition(pair<int, int> a, pair<int, int> b) {
  return pair<int, int>(a.first + b.first, a.second + b.second);
}
pair<int, int> subtraction(pair<int, int> a, pair<int, int> b) {
  return pair<int, int>(a.first - b.first, a.second - b.second);
}
void check_overflow(pair<int, int> a) {
  if (a.first < -10000 || 10000 < a.first) overflow = true;
  if (a.second < -10000 || 10000 < a.second) overflow = true;
}
pair<int, pair<int, int> > dfs(int i = 0,
                               pair<int, int> sum = pair<int, int>(0, 0)) {
  pair<int, pair<int, int> > ans = make_pair(i, pair<int, int>(0, 0));
  while (i < s.size()) {
    if (s[i] == '(') {
      return dfs(i + 1);
    }
    if (s[i] == ')') {
      return pair<int, pair<int, int> >(i, sum);
    }
    if (s[i] == '*') {
      pair<int, pair<int, int> > a = dfs(i + 1);
      return pair<int, pair<int, int> >(a.first, multiplication(sum, a.second));
    }
    if (s[i] == '+') {
      pair<int, pair<int, int> > a = dfs(i + 1);
      return pair<int, pair<int, int> >(a.first, addition(sum, a.second));
    }
    if (s[i] == '-') {
      pair<int, pair<int, int> > a = dfs(i + 1);
      return pair<int, pair<int, int> >(a.first, subtraction(sum, a.second));
    }
    if ('0' <= s[i] && s[i] <= '9') {
      pair<int, int> a = num(i);
      sum.first += a.second;
      i = a.first;
    }
    if (s[i] == 'i') {
      return pair<int, pair<int, int> >(i + 1, pair<int, int>(0, 1));
    }
  }
  return ans;
}
int main() {
  while (cin >> s) {
    pair<int, pair<int, int> > ans = dfs();
    if (overflow) {
      cout << "overflow" << endl;
    } else {
      int real = ans.second.first;
      int imag = ans.second.second;
      if (real && imag) {
        printf("%d%c%di\n", real, (imag > 0 ? '+' : '-'), abs(imag));
      } else if (real) {
        printf("%d\n", real);
      } else if (imag) {
        printf("%di", imag);
      } else {
        puts("0");
      }
    }
  }
}
