static long count ( long D , int l , int t , int [ ] x ) {
  if ( t == N ) {
    if ( D != 0 ) return 0 ;
    long ans = 1 ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) {
      ans *= ( i == 0 ? 9 : 10 ) - Math . abs ( x [ i ] ) ;
    }
    if ( l % 2 == 0 ) ans *= 10 ;
    return ans ;
  }
  long ans = 0 ;
  for ( int m = - 9 ;
  m <= 9 ;
  m ++ ) {
    if ( - v [ t ] < D + v [ t ] * m && D + v [ t ] * m < v [ t ] ) {
      x [ t ] = m ;
      ans += count ( D + v [ t ] * m , l , t + 1 , x ) ;
    }
  }
  return ans ;
}

static long count ( long D , int l , int t , int [ ] x ) { if ( t == N ) { if ( D != 0 ) return 0 ; long ans = 1 ; for ( int i = 0 ; i < N ; i ++ ) { ans *= ( i == 0 ? 9 : 10 ) - Math . abs ( x [ i ] ) ; } if ( l % 2 == 0 ) ans *= 10 ; return ans ; } long ans = 0 ; for ( int m = - 9 ; m <= 9 ; m ++ ) { if ( - v [ t ] < D + v [ t ] * m && D + v [ t ] * m < v [ t ] ) { x [ t ] = m ; ans += count ( D + v [ t ] * m , l , t + 1 , x ) ; } } return ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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 (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (return_statement (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (unary_expression operand: (array_access array: (identifier) index: (identifier))) right: (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) right: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) right: (array_access array: (identifier) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))))))))) (return_statement (identifier))))