



'''simple docstring'''

from __future__ import annotations

from collections.abc import MutableSequence

class __snake_case:


						'''simple docstring'''



						def __init__( self     ,	A_     ,	A_				)     ->     None:
							if len(A_				) != degree + 1:
								raise ValueError(
								    """The number of coefficients should be equal to the degree + 1."""				)

							lowerCAmelCase   =     list(A_				)
							lowerCAmelCase   =     degree


						def __add__( self     ,	A_				)     ->     Polynomial:

							if self.degree > polynomial_a.degree:
								lowerCAmelCase   =     self.coefficients[:]
								for i in range(polynomial_a.degree + 1				):
									coefficients[i] += polynomial_a.coefficients[i]
								return Polynomial(self.degree     ,	A_				)
							else:
								lowerCAmelCase   =     polynomial_a.coefficients[:]
								for i in range(self.degree + 1				):
									coefficients[i] += self.coefficients[i]
								return Polynomial(polynomial_a.degree     ,	A_				)


						def __sub__( self     ,	A_				)     ->     Polynomial:
							return self + polynomial_a * Polynomial(0     ,	[-1]				)


						def __neg__( self				)     ->     Polynomial:
							return Polynomial(self.degree     ,	[-c for c in self.coefficients]				)


						def __mul__( self     ,	A_				)     ->     Polynomial:
							lowerCAmelCase   =     [0] * (self.degree + polynomial_a.degree + 1)
							for i in range(self.degree + 1				):
								for j in range(polynomial_a.degree + 1				):
									coefficients[i + j] += (
									    self.coefficients[i] * polynomial_a.coefficients[j]
									)

							return Polynomial(self.degree + polynomial_a.degree     ,	A_				)


						def     __snake_case   ( self     ,	A_				)     ->     int | float:
							lowerCAmelCase   =     0
							for i in range(self.degree + 1				):
								result += self.coefficients[i] * (substitution**i)
							return result


						def __str__( self				)     ->     str:
							lowerCAmelCase   =     """"""
							for i in range(self.degree     ,	-1     ,	-1				):
								if self.coefficients[i] == 0:
									continue
								elif self.coefficients[i] > 0:
									if polynomial:
										polynomial += " + "
								else:
									polynomial += " - "

								if i == 0:
									polynomial += str(abs(self.coefficients[i]				)				)
								elif i == 1:
									polynomial += str(abs(self.coefficients[i]				)				) + "x"
								else:
									polynomial += str(abs(self.coefficients[i]				)				) + "x^" + str(A_				)

							return polynomial


						def __repr__( self				)     ->     str:
							return self.__str__()


						def     __snake_case   ( self				)     ->     Polynomial:
							lowerCAmelCase   =     [0] * self.degree
							for i in range(self.degree				):
								lowerCAmelCase   =     self.coefficients[i + 1] * (i + 1)
							return Polynomial(self.degree - 1     ,	A_				)


						def     __snake_case   ( self     ,	A_ = 0				)     ->     Polynomial:
							lowerCAmelCase   =     [0] * (self.degree + 2)
							lowerCAmelCase   =     constant
							for i in range(self.degree + 1				):
								lowerCAmelCase   =     self.coefficients[i] / (i + 1)
							return Polynomial(self.degree + 1     ,	A_				)


						def __eq__( self     ,	A_				)     ->     bool:
							if not isinstance(A_     ,	A_				):
								return False

							if self.degree != polynomial_a.degree:
								return False

							for i in range(self.degree + 1				):
								if self.coefficients[i] != polynomial_a.coefficients[i]:
									return False

							return True




						def __ne__( self     ,	A_				)     ->     bool:
							return not self.__eq__(A_				)




'''simple docstring'''

import cmath
import math






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						float							,		_SCREAMING_SNAKE_CASE					:						float							,		_SCREAMING_SNAKE_CASE					:						float							,		_SCREAMING_SNAKE_CASE					:						float							)      ->						complex:







	"""simple docstring"""
	lowerCAmelCase   =     math.radians(_SCREAMING_SNAKE_CASE							)
	lowerCAmelCase   =     math.radians(_SCREAMING_SNAKE_CASE							)

	# Convert voltage and current to rectangular form
	lowerCAmelCase   =     cmath.rect(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							)
	lowerCAmelCase   =     cmath.rect(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							)

	# Calculate apparent power
	return voltage_rect * current_rect


if __name__ == "__main__":
				import doctest

				doctest.testmod()