import math
K = 4.201
L = 3
try:
x = float(input("Enter value for x: "))
if x < 0:
raise ValueError("ERROR: The negative value in square root!")
a_calc_part = K * math.sqrt(x) + 2 - (1 / L) * (math.exp(2) - math.exp(-2))
if a_calc_part < 0:
raise ValueError("ERROR: The negative value in square root for 'a'!")
a = math.sqrt(a_calc_part)
b = math.sin(0.5 * math.atan(-0.25) * math.log(5))
if a > 2 * b:
y = math.sqrt(3 * a - 5 * b)
elif a == 2 * b:
y = a
else:
y_calc_part = 3 * a + 5 * b
if y_calc_part < 0:
raise ValueError("ERROR: The negative value in square root for 'y'!")
y = math.sqrt(y_calc_part)
print("Result y = {:.4f}".format(y))
except ValueError as e:
print(e)
except ZeroDivisionError:
print("ERROR: Division by zero occurred!")
except Exception:
print("ERROR: An unknown error occurred!")
aW1wb3J0IG1hdGgKCksgPSA0LjIwMQpMID0gMwoKdHJ5OgogICAgeCA9IGZsb2F0KGlucHV0KCJFbnRlciB2YWx1ZSBmb3IgeDogIikpCgogICAgaWYgeCA8IDA6CiAgICAgICAgcmFpc2UgVmFsdWVFcnJvcigiRVJST1I6IFRoZSBuZWdhdGl2ZSB2YWx1ZSBpbiBzcXVhcmUgcm9vdCEiKQoKICAgIGFfY2FsY19wYXJ0ID0gSyAqIG1hdGguc3FydCh4KSArIDIgLSAoMSAvIEwpICogKG1hdGguZXhwKDIpIC0gbWF0aC5leHAoLTIpKQogICAgaWYgYV9jYWxjX3BhcnQgPCAwOgogICAgICAgIHJhaXNlIFZhbHVlRXJyb3IoIkVSUk9SOiBUaGUgbmVnYXRpdmUgdmFsdWUgaW4gc3F1YXJlIHJvb3QgZm9yICdhJyEiKQoKICAgIGEgPSBtYXRoLnNxcnQoYV9jYWxjX3BhcnQpCiAgICBiID0gbWF0aC5zaW4oMC41ICogbWF0aC5hdGFuKC0wLjI1KSAqIG1hdGgubG9nKDUpKQoKICAgIGlmIGEgPiAyICogYjoKICAgICAgICB5ID0gbWF0aC5zcXJ0KDMgKiBhIC0gNSAqIGIp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