UVA10642




Sample Input

3
0 0 0 1
0 0 1 0
0 0 0 2

Sample Output
Case 1: 1
Case 2: 2
Case 3: 3



import java.util.Scanner;

public class UVA10642 {

 public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int count = sc.nextInt();

  for (int i = 1; i <= count; i++) {

   int x1 = sc.nextInt();
   int y1 = sc.nextInt();
   int x2 = sc.nextInt();
   int y2 = sc.nextInt();

   System.out.print("Case " + i + ": ");

   System.out.println(calculate(x2, y2) - calculate(x1, y1));

  }

  sc.close();

 }

 private static int calculate(int x, int y) {

  return ((x + y + 1) * (x + y + 2) / 2 - y);

 }

}