/* Problem 2--Palindromic Sums
   The trick to palindromic sums is that the numbers can get HUGE by the
   time they get to be palindromes.  In Java, I used Strings and
   BigIntegers. */

import java.io.*;
import java.util.*;
import java.math.*;

public class prob2 {

 public static Scanner in=null;
 public static PrintWriter out=null;

 public static void main (String[] args) throws Exception {

  in = new Scanner (new File ("prob2.in"));
  out = new PrintWriter ("prob2.out");
  String n="";
  int cs=1;
  while (!(n=in.next()).equals("-1")) {
   out.print ("Case "+(cs++)+": The palindromic sum is ");
   String nr = Reverse (n);
   do { // add the string to its reverse
    n = new BigInteger(n).add(new BigInteger(nr)).toString();
    nr = Reverse (n);
   } while (!n.equals(nr));
   out.println (n);
  }
  in.close();
  out.close();
 }

 /* Reverse takes a string and returns the reverse of it. */
 public static String Reverse (String s) {

  String t = "";
  for (int i=0; i < s.length(); i++)
   t = s.charAt(i)+t;  //Build the string backwards
  return t;
 }
}
