public static void main ( String [ ] args ) {
  int N = sc . nextInt ( ) ;
  for ( int caseID = 1 ;
  caseID <= N ;
  caseID ++ ) {
    int H = sc . nextInt ( ) ;
    int W = sc . nextInt ( ) ;
    int R = sc . nextInt ( ) ;
    boolean [ ] [ ] rock = new boolean [ H ] [ W ] ;
    for ( int i = 0 ;
    i < R ;
    i ++ ) {
      int r = sc . nextInt ( ) - 1 ;
      int c = sc . nextInt ( ) - 1 ;
      rock [ r ] [ c ] = true ;
    }
    int [ ] [ ] count = new int [ H + 2 ] [ W + 2 ] ;
    count [ 0 ] [ 0 ] = 1 ;
    for ( int y = 0 ;
    y < H ;
    y ++ ) {
      for ( int x = 0 ;
      x < W ;
      x ++ ) {
        if ( rock [ y ] [ x ] ) continue ;
        count [ y + 2 ] [ x + 1 ] += count [ y ] [ x ] ;
        count [ y + 2 ] [ x + 1 ] %= P ;
        count [ y + 1 ] [ x + 2 ] += count [ y ] [ x ] ;
        count [ y + 1 ] [ x + 2 ] %= P ;
      }
    }
    System . out . printf ( "Case #%d: %d%n" , caseID , count [ H - 1 ] [ W - 1 ] ) ;
  }
}

public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; for ( int caseID = 1 ; caseID <= N ; caseID ++ ) { int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; boolean [ ] [ ] rock = new boolean [ H ] [ W ] ; for ( int i = 0 ; i < R ; i ++ ) { int r = sc . nextInt ( ) - 1 ; int c = sc . nextInt ( ) - 1 ; rock [ r ] [ c ] = true ; } int [ ] [ ] count = new int [ H + 2 ] [ W + 2 ] ; count [ 0 ] [ 0 ] = 1 ; for ( int y = 0 ; y < H ; y ++ ) { for ( int x = 0 ; x < W ; x ++ ) { if ( rock [ y ] [ x ] ) continue ; count [ y + 2 ] [ x + 1 ] += count [ y ] [ x ] ; count [ y + 2 ] [ x + 1 ] %= P ; count [ y + 1 ] [ x + 2 ] += count [ y ] [ x ] ; count [ y + 1 ] [ x + 2 ] %= P ; } } System . out . printf ( " Case ▁ # % d : ▁ % d % n " , caseID , count [ H - 1 ] [ W - 1 ] ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (true))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal))) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal) (identifier) (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))