


def     UpperCamelCase    (      _a       ,		_a       ,		_a		)					->							int:
     '''simple docstring'''





     def count_of_possible_combinations(_a		) -> int:
          if target < 0:
               return 0
          if target == 0:
               return 1
          return sum(count_of_possible_combinations(target - item		) for item in array		)

     return count_of_possible_combinations(_a		)




def     UpperCamelCase    (      _a       ,		_a       ,		_a		)					->							int:
     '''simple docstring'''





     def count_of_possible_combinations_with_dp_array(
         _a       ,		_a		) -> int:
          if target < 0:
               return 0
          if target == 0:
               return 1
          if dp_array[target] != -1:
               return dp_array[target]
          lowercase_       :Optional[int]     =       sum(
              count_of_possible_combinations_with_dp_array(target - item       ,		_a		)
              for item in array		)
          lowercase_       :List[Any]     =       answer
          return answer

     lowercase_       :Dict     =       [-1] * (target + 1)
     return count_of_possible_combinations_with_dp_array(_a       ,		_a		)




def     UpperCamelCase    (      _a       ,		_a       ,		_a		)					->							int:
     '''simple docstring'''





     lowercase_       :Optional[int]     =       [0] * (target + 1)
     lowercase_       :int     =       1

     for i in range(1       ,		target + 1		):
          for j in range(_a		):
               if i - array[j] >= 0:
                    dp_array[i] += dp_array[i - array[j]]

     return dp_array[target]


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   SCREAMING_SNAKE_CASE       :		Optional[Any]         =  3
   SCREAMING_SNAKE_CASE       :		Tuple         =  5
   SCREAMING_SNAKE_CASE       :		List[Any]         =  [1, 2, 5]
   print(combination_sum_iv(n, array, target))





def     UpperCamelCase    (      _a       ,		_a		)					->							int:
     '''simple docstring'''





     while a != 0:
          lowercase_    ,      lowercase_       :Union[str, Any]     =       b % a, a
     return b




def     UpperCamelCase    (      _a       ,		_a		)					->							int:
     '''simple docstring'''





     if gcd(_a       ,		_a		) != 1:
          lowercase_       :Union[str, Any]     =       f"mod inverse of {a!r} and {m!r} does not exist"
          raise ValueError(_a		)
     lowercase_    ,      lowercase_    ,      lowercase_       :Any     =       1, 0, a
     lowercase_    ,      lowercase_    ,      lowercase_       :List[str]     =       0, 1, m
     while va != 0:
          lowercase_       :Tuple     =       ua // va
          lowercase_    ,      lowercase_    ,      lowercase_    ,      lowercase_    ,      lowercase_    ,      lowercase_       :Optional[int]     =       (ua - q * va), (ua - q * va), (ua - q * va), va, va, va
     return ua % m

