
'''simple docstring'''




def 		lowerCAmelCase_				(   snake_case__		,				snake_case__						):




    '''simple docstring'''



    if discount_rate < 0:
        raise ValueError('''Discount rate cannot be negative'''						)
    if not cash_flows:
        raise ValueError('''Cash flows list cannot be empty'''						)
    A       :   List[Any]					=						sum(
        cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(snake_case__						)						)
    return round(snake_case__		,				ndigits=2						)


if __name__ == "__main__":
      import doctest

      doctest.testmod()









'''simple docstring'''




from __future__ import annotations


def 				lowerCAmelCase_   (	_lowerCamelCase:   list[int]       ,      _lowerCamelCase:   list[int]       ,      _lowerCamelCase:   int					):
		__SCREAMING_SNAKE_CASE       :		List[Any]           =		list(range(len(_lowerCamelCase					)					)					)
		__SCREAMING_SNAKE_CASE       :		Optional[Any]           =		[v / w for v, w in zip(_lowerCamelCase       ,      _lowerCamelCase					)]
		index.sort(key=lambda _lowerCamelCase					: ratio[i]       ,      reverse=_lowerCamelCase					)

		__SCREAMING_SNAKE_CASE       :		float           =		0
		__SCREAMING_SNAKE_CASE       :		list[float]           =		[0] * len(_lowerCamelCase					)
		for i in index:
				if weight[i] <= capacity:
						__SCREAMING_SNAKE_CASE       :		str           =		1
						max_value += value[i]
						capacity -= weight[i]
				else:
						__SCREAMING_SNAKE_CASE       :		int           =		capacity / weight[i]
						max_value += value[i] * capacity / weight[i]
						break

		return max_value, fractions


if __name__ == "__main__":
						import doctest

						doctest.testmod()