#include <bits/stdc++.h>
using namespace std;

int a, b, c, d;
int case_num;
// make operators negative numbers
int ops[4] = {'+' | (1 << 31), '-' | (1 << 31), '*' | (1 << 31), '/' | (1 << 31)};

int evalRPN(vector<int> x) {
  stack<int> s;
  for (int op : x) {
    if (op < 0) {
      int a = s.top();
      s.pop();
      int b = s.top();
      s.pop();
      char oper = (char) (op & 0xff);
      if (oper == '+') {
        s.push(a + b);
      } else if (oper == '-') {
        s.push(b - a);
      } else if (oper == '*') {
        s.push(a * b);
      } else {
        if (a == 0 || b % a) {
          throw invalid_argument("");
        }
        s.push(b / a);
      }
    } else {
      s.push(op);
    }
  }
  return s.top();
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  while (cin >> a >> b >> c >> d && (a || b || c || d) ) {
    cout << "Case " << ++case_num << ": ";
    int nums[] = {a, b, c, d};
    int index[] = {0, 1, 2, 3};
    set<int> results;
    do {
      int u, v, x, y;
      u = nums[index[0]];
      v = nums[index[1]];
      x = nums[index[2]];
      y = nums[index[3]];
      for (auto op0 : ops) {
        for (auto op1 : ops) {
          for (auto op2 : ops) {
            try {
              results.insert(evalRPN({u, v, x, y, op0, op1, op2}));
            } catch(const invalid_argument& e) { /* we are fine */ }
            try {
              results.insert(evalRPN({u, v, x, op0, y, op1, op2}));
            } catch(const invalid_argument& e) { /* we are fine */ }
            try {
              results.insert(evalRPN({u, v, x, op0, op1, y, op2}));
            } catch(const invalid_argument& e) { /* we are fine */ }
            try {
              results.insert(evalRPN({u, v, op0, x, op1, y, op2}));
            } catch(const invalid_argument& e) { /* we are fine */ }
            try {
              results.insert(evalRPN({u, v, op0, x, y, op1, op2}));
            } catch(const invalid_argument& e) { /* we are fine */ }
          }
        }
      }
    } while (next_permutation(index, index + 4));
    
    vector<int> r;

    for (auto x : results) {
      r.push_back(x);
    }

    int lower = 0;
    int ml = r.size() - 1;
    int mu = r.size() - 1;
    int length = 1;
    int maxlength = 1;
    for (int i = 1; i < r.size(); i++) {
      if (r[i - 1] + 1 == r[i]) {
        length++;
        if (length >= maxlength) {
          ml = lower;
          mu = i;
          maxlength = length;
        }
      } else {
        lower = i;
        length = 1;
      }
    }
    cout << r[ml] << " to " << r[mu] << endl;
  }

  return 0;
}