#include <stdio.h>
int n, a[21], flag[21], ar[41], ans, nnum, ff;
int gcd(int, int), abs(int), shuffle(int), solve(), solve2(), write(), write2();

int gcd(int x, int y) {
  int t;
  while( y ) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}

int abs(int x){
  return x > 0 ? x : -x;
}

int shuffle(int b) {
  if(b == 2 * n - 1) {
    solve2();
  } else {
    int i;
    for(i = 0; i < n; ++i) {
      if(!flag[i]) {
        ar[b] = a[i];
        flag[i] = 1;
        nnum++;
        shuffle(b + 1);
        flag[i] = 0;
        nnum--;
      }
    }
    if(nnum > 1) {
      for(i = -2; i < 1; ++i) {
        ar[b] = i;
        --nnum;
        shuffle(b + 1);
        ++nnum;
      }
    }
  }
  return 0;
}

int solve() {
  int num = 0, i;
  double tar[n + 2];
  /*for(i = 0; i < 2 * n - 1; ++i) printf("%d ", ar[i]);
  printf("\n");*/
  for(i = 0; i < 2 * n - 1; ++i) {
    //printf("%d", i);
    if(ar[i] > 0) {
      tar[num] = ar[i];
      num++;
    } else {
      if(!num) return 0;
      num--;
      if(!ar[i]) {
        tar[num - 1] += tar[num];
      } else if(ar[i] == -1) {
        tar[num - 1] -= tar[num];
      } else if(ar[i] == -2) {
        tar[num - 1] *= tar[num];
      }
    }
  }
  if((int)(tar[0] * 10) % 10 > 9) {
    tar[0] += 0.1;
  }
  //printf("%d %d ", tar[num - 1], tar[0]);
  if((int)(tar[0] * 10) % 10 < 1 && (int)tar[0] == ans) write2();
  return 0;
}

int solve2() {
  int num = 0, i;
  int tard[n + 2], taru[n + 2];
  /*for(i = 0; i < 2 * n - 1; ++i) printf("%d ", ar[i]);
  printf("\n");*/
  for(i = 0; i < 2 * n - 1; ++i) {
    if(ar[i] > 0) {
      taru[num] = ar[i];
      tard[num] = 1;
      num++;
    } else {
      if(!num) return 0;
      num--;
      if(!ar[i]) {
        int t = gcd(tard[num], tard[num - 1]);
        int t2 = tard[num - 1] / t;
        taru[num - 1] *= tard[num] / t;
        tard[num - 1] *= tard[num] / t;
        taru[num - 1] += taru[num] * t2;
      } else if(ar[i] == -1) {
        int t = gcd(tard[num], tard[num - 1]);
        int t2 = tard[num - 1] / t;
        taru[num - 1] *= tard[num] / t;
        tard[num - 1] *= tard[num] / t;
        taru[num - 1] -= taru[num] * t2;
      } else if(ar[i] == -2) {
        taru[num - 1] *= taru[num];
        tard[num - 1] *= tard[num];
      } else {
        taru[num - 1] *= tard[num];
        tard[num - 1] *= taru[num];
        if(!tard[num - 1]) return 0;
        if(tard[num - 1] < 0) tard[num - 1] *= -1, taru[num - 1] *= -1;
      }
      int t;
      if((t = gcd(tard[num - 1], abs(taru[num - 1]))) != 1) {
        tard[num - 1] /= t;
        taru[num - 1] /= t;
      }
    }
  }
  //printf("%d %d ", tar[num - 1], tar[0]);
  if(tard[0] == 1 && taru[0] == ans) write2();
  return 0;
}

int write() {
  if(!ff) return 0;
  int i, num = 0, tar[n + 2];
  for(i = 0; i < 2 * n - 1; ++i) {
    if(ar[i] > 0) {
      printf("%d ", ar[i]);
    } else if(!ar[i]) {
      printf("+ ");
    } else if(ar[i] == -1){
      printf("- ");
    } else if(ar[i] == -2) {
      printf("* ");
    } else if(ar[i] == -3){
      printf("/ ");
    }
  }
  printf("\n");
  ff = 0;
  return 0;
}

int write2() {
  if(!ff) return 0;
  int i, num1 = 0, j, k, ta = 0;
  int b[n][4 * n], num2[n];
  for(i = 0; i < 2 * n - 1; ++i) {
    if(ar[i] > 0) {
      b[num1][0] = ar[i];
      num2[num1] = 1;
      num1++;
    } else {
      if(!ar[i] || ar[i] == -1) {
        num1--;
        if(b[num1 - 1][0] == -10 && b[num1 - 1][num2[num1 - 1] - 1] == -11) {
          for(j = 0; j < num2[num1 - 1] - 1; ++j) b[num1 - 1][j] = b[num1 - 1][j + 1];
          num2[num1 - 1] -= 2;
        }
        if(!ar[i]) {
          if(b[num1][0] == -10 && b[num1][num2[num1] - 1] == -11) {
            for(j = 0; j < num2[num1] - 1; ++j) b[num1][j] = b[num1][j + 1];
            num2[num1] -= 2;
          }
        }
        b[num1 - 1][num2[num1 - 1]] = ar[i];
        int tt = num2[num1 - 1] + 1;
        for(j = 0; j < num2[num1]; ++j) {
          b[num1 - 1][tt] = b[num1][j];
          ++tt;
        }
        num2[num1 - 1] = tt;
        for(j = num2[num1 - 1]; j > 0; --j) b[num1 - 1][j] = b[num1 - 1][j - 1];
        b[num1 - 1][0] = -10;
        b[num1 - 1][num2[num1 - 1] + 1] = -11;
        num2[num1 - 1] += 2;
        ta = 1;
      } else {
        num1--;
        b[num1 - 1][num2[num1 - 1]] = ar[i];
        int tt = num2[num1 - 1] + 1;
        for(j = 0; j < num2[num1]; ++j) {
          b[num1 - 1][tt] = b[num1][j];
          ++tt;
        }
        num2[num1 - 1] = tt;
        for(j = num2[num1 - 1]; j > 0; --j) b[num1 - 1][j] = b[num1 - 1][j - 1];
        b[num1 - 1][0] = -10;
        b[num1 - 1][num2[num1 - 1] + 1] = -11;
        num2[num1 - 1] += 2;
        ta = 1;
      }
    }
    /*for(j = 0; j < num1; ++j) {
      for(k = 0; k < num2[j]; ++k) printf("%d ", b[j][k]);
      printf("\n");
    }
    printf("\n");*/
  }
  int an = 0, bn = num2[0];
  if(ta) an++, bn--;
  for(i = an; i < bn; ++i) {
    if(b[0][i] > 0) printf("%d ", b[0][i]);
    else if(!b[0][i]) printf("+ ");
    else if(b[0][i] == -1) printf("- ");
    else if(b[0][i] == -2) printf("* ");
    else if(b[0][i] == -3) printf("/ ");
    else if(b[0][i] == -10) printf("( ");
    else printf(") ");
  }
  printf("\n");
  ff = 0;
  return 0;
}

int main(void) {
  while( 1 ) {
  ff = 1;
  int i, j, k;
  nnum = 0;
  n = 4, ans = 10;
  for(i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    if(a[i] < 1) return 0;
  }
  if(!a[0]) break;
  for(i = 0; i < n; ++i) flag[i] = 0;
  shuffle(0);
  if(ff) printf("0\n");
  }
  return 0;
}


Measured memory_bytes: 2696