



import math
import random







def     UpperCAmelCase_		(					snake_case__    ,			snake_case__ = False					)	->     float:



				"""simple docstring"""





				if deriv:
								return value * (1 - value)
				return 1 / (1 + math.exp(-value					))


# Initial Value
_lowerCAmelCase	:   Union[str, Any]    =   0.0_2







def     UpperCAmelCase_		(					snake_case__    ,			snake_case__					)	->     float:



				"""simple docstring"""





				lowerCAmelCase__		  =  float(2 * (random.randint(1    ,			100					)) - 1					)

				for _ in range(snake_case__					):
								# Forward propagation
								lowerCAmelCase__		  =  sigmoid_function(INITIAL_VALUE * weight					)
								# How much did we miss?
								lowerCAmelCase__		  =  (expected / 100) - layer_a
								# Error delta
								lowerCAmelCase__		  =  layer_1_error * sigmoid_function(snake_case__    ,			snake_case__					)
								# Update weight
								weight += INITIAL_VALUE * layer_1_delta

				return layer_a * 100


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	_lowerCAmelCase	:   List[str]    =   int(input("Expected value: "))
	_lowerCAmelCase	:   Any    =   int(input("Number of propagations: "))
	print(forward_propagation(expected, number_propagations))





from bisect import bisect
from itertools import accumulate







def     UpperCAmelCase_		(					snake_case__    ,			snake_case__    ,			snake_case__    ,			snake_case__					)	->     Optional[int]:



				"""simple docstring"""





				lowerCAmelCase__		  =  sorted(zip(snake_case__    ,			snake_case__					)    ,			key=lambda snake_case__					: x[0] / x[1]    ,			reverse=snake_case__					)
				lowerCAmelCase__  ,   lowerCAmelCase__		  =  [i[0] for i in r], [i[1] for i in r]
				lowerCAmelCase__		  =  list(accumulate(snake_case__					)					)
				lowerCAmelCase__		  =  bisect(snake_case__    ,			snake_case__					)
				return (
				    0
				    if k == 0
				    else sum(vl[:k]					) + (w - acc[k - 1]) * (vl[k]) / (wt[k])
				    if k != n
				    else sum(vl[:k]					)
				)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
