public static long calc ( long [ ] vs , long D ) {
  long res = 1 ;
  long ten = 10 ;
  for ( int i = 0 ;
  i < vs . length ;
  i ++ ) {
    long now = 0 ;
    while ( D % ten != 0 && now < 9 ) {
      D -= vs [ i ] ;
      now ++ ;
    }
    D = Math . abs ( D ) ;
    ten *= 10 ;
    res *= ( i == 0 ) ? ( 9 - now ) : ( 10 - now ) ;
  }
  return D == 0 ? res : 0 ;
}

public static long calc ( long [ ] vs , long D ) { long res = 1 ; long ten = 10 ; for ( int i = 0 ; i < vs . length ; i ++ ) { long now = 0 ; while ( D % ten != 0 && now < 9 ) { D -= vs [ i ] ; now ++ ; } D = Math . abs ( D ) ; ten *= 10 ; res *= ( i == 0 ) ? ( 9 - now ) : ( 10 - now ) ; } return D == 0 ? res : 0 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (ternary_expression condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))) alternative: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))))) (return_statement (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (identifier) alternative: (decimal_integer_literal)))))