



import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
							import ctypes
							import msvcrt  # noqa


							class      __lowerCAmelCase     (		ctypes.Structure      ):
												"""simple docstring"""






												A__				:		Dict			       =    [("size", ctypes.c_int), ("visible", ctypes.c_byte)]


def A						(       )						->      Dict:
			if os.name == "nt":
						A__       =    CursorInfo()
						A__       =    ctypes.windll.kernelaa.GetStdHandle(-11					)
						ctypes.windll.kernelaa.GetConsoleCursorInfo(__UpperCamelCase ,	ctypes.byref(__UpperCamelCase					)					)
						A__       =    False
						ctypes.windll.kernelaa.SetConsoleCursorInfo(__UpperCamelCase ,	ctypes.byref(__UpperCamelCase					)					)
			elif os.name == "posix":
						sys.stdout.write('\033[?25l'					)
						sys.stdout.flush()


def A						(       )						->      Optional[int]:
			if os.name == "nt":
						A__       =    CursorInfo()
						A__       =    ctypes.windll.kernelaa.GetStdHandle(-11					)
						ctypes.windll.kernelaa.GetConsoleCursorInfo(__UpperCamelCase ,	ctypes.byref(__UpperCamelCase					)					)
						A__       =    True
						ctypes.windll.kernelaa.SetConsoleCursorInfo(__UpperCamelCase ,	ctypes.byref(__UpperCamelCase					)					)
			elif os.name == "posix":
						sys.stdout.write('\033[?25h'					)
						sys.stdout.flush()






@contextmanager
def A						(       )						->      int:
			try:
						hide_cursor()
						yield
			finally:
						show_cursor()









import math
import random


def A						(       __UpperCamelCase ,	__UpperCamelCase = False					)						->      float:
			if deriv:
						return value * (1 - value)
			return 1 / (1 + math.exp(-value					))


# Initial Value
SCREAMING_SNAKE_CASE__       =      0.02


def A						(       __UpperCamelCase ,	__UpperCamelCase					)						->      float:
			A__       =    float(2 * (random.randint(1 ,	100					)) - 1					)

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

			return layer_a * 100


if __name__ == "__main__":
							import doctest

							doctest.testmod()

							SCREAMING_SNAKE_CASE__       =      int(input('''Expected value: '''))
							SCREAMING_SNAKE_CASE__       =      int(input('''Number of propagations: '''))
							print(forward_propagation(expected, number_propagations))




