import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String s[] = sc.nextLine().replace("i", "").split(" ");
            int x1 = 1, x2 = 1;
            if (s[0].charAt(0) == '-') {
                s[0] = s[0].substring(1, s[0].length());
                x1 *= -1;
            }
            if (s[0].indexOf("+") != -1) {
                x1 *= Integer.parseInt(s[0].split("\\+")[0]);
                x2 *= Integer.parseInt(s[0].split("\\+")[1]);
            } else {
                x1 *= Integer.parseInt(s[0].split("-")[0]);
                x2 *= Integer.parseInt(s[0].split("-")[1]) * (-1);
            }
            int y1 = 1, y2 = 1;
            if (s[2].charAt(0) == '-') {
                s[2] = s[2].substring(1, s[2].length());
                y1 *= -1;
            }
            if (s[2].indexOf('+') != -1) {
                y1 *= Integer.parseInt(s[2].split("\\+")[0]);
                y2 *= Integer.parseInt(s[2].split("\\+")[1]);
            } else {
                y1 *= Integer.parseInt(s[2].split("-")[0]);
                y2 *= Integer.parseInt(s[2].split("-")[1]) * (-1);
            }
            if (s[1].equals("+")) {
                x1 = x1 + y1;
                x2 = x2 + y2;
            } else {
                x1 = x1 - y1;
                x2 = x2 - y2;
            }
            String c = (x2 >= 0 ? "+" : "");
            System.out.printf("%d%s%di\n", x1, c, x2);
        }
    }
}