1. 

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 10784 Diagonal
*
* @author Robert Reichart
*
* Status : Accepted
* Runtime: 0.212
*/

import java.io.*;

class Main{
public static void main(String... args)throws IOException{
BufferedReader is= new BufferedReader(new InputStreamReader(System.in));
long wert = 0;
long count =0;

while(true){
String line=is.readLine();

if (line!=null && !line.equals("")){
if (line.equals("0")){break;}
wert=Long.parseLong(line);
count++;
long result =(long)(Math.ceil((3 + Math.sqrt((9 +8*wert))) / 2));

System.out.println("Case " + count + ": " + result);


}
}
}
}