


from __future__ import annotations

import math

class 		__a				:
		def __init__(      self      ,   _SCREAMING_SNAKE_CASE						)			->	None:




									"""simple docstring"""





									_UpperCAmelCase					=      size
									# approximate the overall size of segment tree with given value
									_UpperCAmelCase					=      [0 for i in range(0      ,   4 * size						)]
									# create array to store lazy update
									_UpperCAmelCase					=      [0 for i in range(0      ,   4 * size						)]
									_UpperCAmelCase					=      [0 for i in range(0      ,   4 * size						)]  # flag for lazy update
		def      UpperCAmelCase__    (      self      ,   _SCREAMING_SNAKE_CASE						)			->	int:




									"""simple docstring"""





									return idx * 2
		def      UpperCAmelCase__    (      self      ,   _SCREAMING_SNAKE_CASE						)			->	int:




									"""simple docstring"""





									return idx * 2 + 1
		def      UpperCAmelCase__    (      self      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)			->	None:




									"""simple docstring"""





									if left_element == right_element:
																_UpperCAmelCase					=      a[left_element - 1]
									else:
																_UpperCAmelCase					=      (left_element + right_element) // 2
																self.build(self.left(_SCREAMING_SNAKE_CASE						)      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)
																self.build(self.right(_SCREAMING_SNAKE_CASE						)      ,   mid + 1      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)
																_UpperCAmelCase					=      max(
																    self.segment_tree[self.left(_SCREAMING_SNAKE_CASE						)]      ,   self.segment_tree[self.right(_SCREAMING_SNAKE_CASE						)]						)
		def      UpperCAmelCase__    (      self      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)			->	bool:




									"""simple docstring"""





									if self.flag[idx] is True:
																_UpperCAmelCase					=      self.lazy[idx]
																_UpperCAmelCase					=      False
																if left_element != right_element:
																							_UpperCAmelCase					=      self.lazy[idx]
																							_UpperCAmelCase					=      self.lazy[idx]
																							_UpperCAmelCase					=      True
																							_UpperCAmelCase					=      True

									if right_element < a or left_element > b:
																return True
									if left_element >= a and right_element <= b:
																_UpperCAmelCase					=      val
																if left_element != right_element:
																							_UpperCAmelCase					=      val
																							_UpperCAmelCase					=      val
																							_UpperCAmelCase					=      True
																							_UpperCAmelCase					=      True
																return True
									_UpperCAmelCase					=      (left_element + right_element) // 2
									self.update(self.left(_SCREAMING_SNAKE_CASE						)      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)
									self.update(self.right(_SCREAMING_SNAKE_CASE						)      ,   mid + 1      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)
									_UpperCAmelCase					=      max(
									    self.segment_tree[self.left(_SCREAMING_SNAKE_CASE						)]      ,   self.segment_tree[self.right(_SCREAMING_SNAKE_CASE						)]						)
									return True
		def      UpperCAmelCase__    (      self      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)			->	int | float:




									"""simple docstring"""





									if self.flag[idx] is True:
																_UpperCAmelCase					=      self.lazy[idx]
																_UpperCAmelCase					=      False
																if left_element != right_element:
																							_UpperCAmelCase					=      self.lazy[idx]
																							_UpperCAmelCase					=      self.lazy[idx]
																							_UpperCAmelCase					=      True
																							_UpperCAmelCase					=      True
									if right_element < a or left_element > b:
																return -math.inf
									if left_element >= a and right_element <= b:
																return self.segment_tree[idx]
									_UpperCAmelCase					=      (left_element + right_element) // 2
									_UpperCAmelCase					=      self.query(self.left(_SCREAMING_SNAKE_CASE						)      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)
									_UpperCAmelCase					=      self.query(self.right(_SCREAMING_SNAKE_CASE						)      ,   mid + 1      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)
									return max(_SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)






		def __str__(      self						)			->	str:




									"""simple docstring"""





									return str([self.query(1      ,   1      ,   self.size      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						) for i in range(1      ,   self.size + 1						)]						)


if __name__ == "__main__":
						lowerCAmelCase__  :int             =							[1, 2, -4, 7, 3, -5, 6, 1_1, -2_0, 9, 1_4, 1_5, 5, 2, -8]
						lowerCAmelCase__  :List[Any]             =							1_5
						lowerCAmelCase__  :Tuple             =							SegmentTree(size)
						segt.build(1, 1, size, A)
						print(segt.query(1, 1, size, 4, 6))
						print(segt.query(1, 1, size, 7, 1_1))
						print(segt.query(1, 1, size, 7, 1_2))
						segt.update(1, 1, size, 1, 3, 1_1_1)
						print(segt.query(1, 1, size, 1, 1_5))
						segt.update(1, 1, size, 7, 8, 2_3_5)
						print(segt)




import math
import random

def 	lowerCAmelCase__			(      a__:		float      ,  a__:		bool = False	)  ->		float:


							'''simple docstring'''





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


# Initial Value
lowerCAmelCase__  :Optional[Any]             =							0.02

def 	lowerCAmelCase__			(      a__:		int      ,  a__:		int	)  ->		float:


							'''simple docstring'''





							_UpperCAmelCase					=      float(2 * (random.randint(1      ,  1_0_0	)) - 1	)

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

							return layer_a * 1_0_0


if __name__ == "__main__":
		import doctest

		doctest.testmod()

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