You are given four points $A,B,C$ and $\mbox{D}$ in a 3-dimensional Cartesian coordinate system. You are required to print the angle between the plane made by the points $A,B,C$ and $B,C,D$ in degrees(not radians). Let the angle be $\textit{PHI}$. 

$\textit{Cos}(PHI)=(X.Y)/|X||Y|$ where $X=\textit{AB}$ x $\mbox{BC}$ and $\textbf{Y}=\textit{BC}$ x $\boldsymbol{\mathrm{CD}}$. 

Here, $X.Y$ means the dot product of $\mbox{X}$ and $\mathbf{Y}$, and $\boldsymbol{AB}$ x $\mbox{BC}$ means the cross product of vectors $\boldsymbol{AB}$ and $\mbox{BC}$. Also, $\textit{AB}=B-A$.

Input Format

One line of input containing the space separated floating number values of the $X,Y$ and $\mbox{z}$ coordinates of a point.  

Output Format

Output the angle correct up to two decimal places.

Sample Input

0 4 5
1 7 6
0 5 9
1 7 2

Sample Output

8.19

Source: hackerrank | Difficulty: EASY


Solutions:
from math import acos, degrees

def vector(a, b):
	return [b[0] - a[0], b[1] - a[1], b[2] - a[2]]

def length(a):
	return (a[0] ** 2 + a[1] ** 2 + a[2] ** 2) ** 0.5

def cross_product(a, b):
	c_x = a[1] * b[2] - a[2] * b[1]
	c_y = a[2] * b[0] - a[0] * b[2]
	c_z = a[0] * b[1] - a[1] * b[0]
	return [c_x, c_y, c_z]

def angle_between(a, b):
	return acos(dot_product(a, b) / (length(a) * length(b)))

def dot_product(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
a = [float(n) for n in input().split()]
b = [float(n) for n in input().split()]
c = [float(n) for n in input().split()]
d = [float(n) for n in input().split()]
ab = vector(a, b)
bc = vector(b, c)
cd = vector(c, d)
x = cross_product(ab, bc)
y = cross_product(bc, cd)
print('%.2f' % degrees(angle_between(x, y)))


from math import acos, pi

class Vector:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __str__(self, format='%.2f'):
		return ('(' + format + ', ' + format + ', ' + format + ')') % (self.x, self.y, self.z)

	def __sub__(self, v):
		return Vector(self.x - v.x, self.y - v.y, self.z - v.z)

	def dot(self, v):
		return self.x * v.x + self.y * v.y + self.z * v.z

	def cross(self, v):
		return Vector(self.y * v.z - self.z * v.y, self.z * v.x - self.x * v.z, self.x * v.y - self.y * v.x)

	def norm(self):
		return (self.x * self.x + self.y * self.y + self.z * self.z) ** 0.5
A = Vector(*tuple((float(_) for _ in input().split())))
B = Vector(*tuple((float(_) for _ in input().split())))
C = Vector(*tuple((float(_) for _ in input().split())))
D = Vector(*tuple((float(_) for _ in input().split())))
X = (B - A).cross(C - B)
Y = (C - B).cross(D - C)
c = X.dot(Y) / X.norm() / Y.norm()
print('%.2f' % (acos(c) / pi * 180))


import math

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def cross(self, other):
		return Point(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def __sub__(self, other):
		return Point(self.x - other.x, self.y - other.y, self.z - other.z)

	def mod(self):
		return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z)
a = list(map(float, input().split()))
b = list(map(float, input().split()))
c = list(map(float, input().split()))
d = list(map(float, input().split()))
A = Point(a[0], a[1], a[2])
B = Point(b[0], b[1], b[2])
C = Point(c[0], c[1], c[2])
D = Point(d[0], d[1], d[2])
X = (B - A).cross(C - B)
Y = (C - B).cross(D - C)
cphi = X.dot(Y) / (X.mod() * Y.mod())
print('%.2f' % (math.acos(cphi) * 180 / math.pi))


import math

class P(object):

	def __init__(self, x, y, z):
		(self.x, self.y, self.z) = (x, y, z)

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def norm(self):
		return math.sqrt(self.dot(self))

	def cross(self, other):
		return P(self.y * other.z - other.y * self.z, self.z * other.x - other.z * self.x, self.x * other.y - other.x * self.y)

	def __sub__(self, other):
		return P(self.x - other.x, self.y - other.y, self.z - other.z)
A = P(*map(float, input().split()))
B = P(*map(float, input().split()))
C = P(*map(float, input().split()))
D = P(*map(float, input().split()))
X = (A - B).cross(B - C)
Y = (B - C).cross(C - D)
PHI = math.acos(X.dot(Y) / (X.norm() * Y.norm()))
print('%.2f' % (PHI / math.pi * 180))


import math
a = input().split()
b = input().split()
c = input().split()
d = input().split()
al = []
bl = []
cl = []
dl = []
al = list(map(float, a))
bl = list(map(float, b))
cl = list(map(float, c))
dl = list(map(float, d))
ab = []
bc = []
cd = []
for i in range(3):
	ab.append(bl[i] - al[i])
	bc.append(cl[i] - bl[i])
	cd.append(dl[i] - cl[i])
c1 = ab[1] * bc[2] - ab[2] * bc[1]
c2 = ab[2] * bc[0] - ab[0] * bc[2]
c3 = ab[0] * bc[1] - ab[1] * bc[0]
x = [c1, c2, c3]
c4 = bc[1] * cd[2] - bc[2] * cd[1]
c5 = bc[2] * cd[0] - bc[0] * cd[2]
c6 = bc[0] * cd[1] - bc[1] * cd[0]
y = [c4, c5, c6]
dotp = x[0] * y[0] + x[1] * y[1] + x[2] * y[2]
modx = math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2])
mody = math.sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2])
modxy = modx * mody
final = dotp / modxy
z = math.acos(final)
t = math.degrees(z)
print('%.2f' % t)


import operator
import math

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, other):
		x = self.x - other.x
		y = self.y - other.y
		z = self.z - other.z
		return Point(x, y, z)

	def cross(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return Point(x, y, z)

	def val(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
A = Point(*map(float, input().split(' ')))
B = Point(*map(float, input().split(' ')))
C = Point(*map(float, input().split(' ')))
D = Point(*map(float, input().split(' ')))
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
X_dot_Y = sum(map(operator.mul, (X.x, X.y, X.z), (Y.x, Y.y, Y.z)))
phi = X_dot_Y / (X.val() * Y.val())
print(round(math.degrees(math.acos(phi)), 2))


import math
A = list(map(float, input().split()))
B = list(map(float, input().split()))
C = list(map(float, input().split()))
D = list(map(float, input().split()))

def minus(X, Y):
	return list(map(lambda x: x[0] - x[1], zip(X, Y)))

def dot(X, Y):
	return sum(map(lambda x: x[0] * x[1], zip(X, Y)))

def cross(X, Y):
	return [X[1] * Y[2] - X[2] * Y[1], X[2] * Y[0] - X[0] * Y[2], X[0] * Y[1] - X[1] * Y[0]]

def length(X):
	return math.sqrt(sum(map(lambda x: x ** 2, X)))
Z1 = cross(minus(B, A), minus(C, B))
Z2 = cross(minus(C, B), minus(D, C))
angle = math.acos(dot(Z1, Z2) / (length(Z1) * length(Z2))) * 180 / math.pi
print('%.2f' % angle)


import math
a = list(map(float, input().split()))
b = list(map(float, input().split()))
c = list(map(float, input().split()))
d = list(map(float, input().split()))
(ab, bc, cd) = ([], [], [])
for i in range(3):
	ab.append(float(b[i] - a[i]))
	bc.append(float(c[i] - b[i]))
	cd.append(float(d[i] - c[i]))
x = [float(ab[1] * bc[2] - ab[2] * bc[1]), -float(ab[0] * bc[2] - ab[2] * bc[0]), float(ab[0] * bc[1] - ab[1] * bc[0])]
y = [float(bc[1] * cd[2] - bc[2] * cd[1]), -float(bc[0] * cd[2] - bc[2] * cd[0]), float(bc[0] * cd[1] - bc[1] * cd[0])]
ans = float((x[0] * y[0] + x[1] * y[1] + x[2] * y[2]) / ((x[0] ** 2 + x[1] ** 2 + x[2] ** 2) ** 0.5 * (y[0] ** 2 + y[1] ** 2 + y[2] ** 2) ** 0.5))
print('%.2f' % math.degrees(math.acos(ans)))


import math
A = input()
B = input()
C = input()
D = input()
ABCD = [A, B, C, D]
ABCD = list(map(lambda A: A.split(), ABCD))
for i in range(4):
	ABCD[i] = list(map(float, ABCD[i]))
AB = [ABCD[1][i] - ABCD[0][i] for i in range(3)]
BC = [ABCD[2][i] - ABCD[1][i] for i in range(3)]
CD = [ABCD[3][i] - ABCD[2][i] for i in range(3)]
X = [AB[1] * BC[2] - AB[2] * BC[1], AB[2] * BC[0] - AB[0] * BC[2], AB[0] * BC[1] - AB[1] * BC[0]]
Y = [BC[1] * CD[2] - BC[2] * CD[1], BC[2] * CD[0] - BC[0] * CD[2], BC[0] * CD[1] - BC[1] * CD[0]]
modX = math.sqrt(X[0] ** 2 + X[1] ** 2 + X[2] ** 2)
modY = math.sqrt(Y[0] ** 2 + Y[1] ** 2 + Y[2] ** 2)
XdotY = X[0] * Y[0] + X[1] * Y[1] + X[2] * Y[2]
cosphi = XdotY / (modX * modY)
phi = math.acos(cosphi)
phideg = math.degrees(phi)
print('{0:.2f}'.format(phideg))


import math

class Point:

	def __init__(self, x, y, z):
		self.x = float(x)
		self.y = float(y)
		self.z = float(z)

class Vector:

	def __init__(self, vx, vy, vz):
		self.vx = vx
		self.vy = vy
		self.vz = vz

	def __sub__(self, vec2):
		return Vector(self.vx - vec2.vx, self.vy - vec2.vy, self.vz - vec2.vz)

	def dot(self, vec2):
		return self.vx * vec2.vx + self.vy * vec2.vy + self.vz * vec2.vz

	def __abs__(self):
		return math.sqrt(self.dot(self))

	def cross(self, vec2):
		xcomp = self.vy * vec2.vz - self.vz * vec2.vy
		ycomp = -self.vx * vec2.vz + self.vz * vec2.vx
		zcomp = self.vx * vec2.vy - self.vy * vec2.vx
		return Vector(xcomp, ycomp, zcomp)

	def __str__(self):
		return '{:.2f} {:.2f} {:.2f}'.format(self.vx, self.vy, self.vz)
A = [float(__) for __ in input().split()]
B = [float(__) for __ in input().split()]
C = [float(__) for __ in input().split()]
D = [float(__) for __ in input().split()]
VA = Vector(A[0], A[1], A[2])
VB = Vector(B[0], B[1], B[2])
VC = Vector(C[0], C[1], C[2])
VD = Vector(D[0], D[1], D[2])
AB = VB - VA
BC = VC - VB
CD = VD - VC
X = AB.cross(BC)
Y = BC.cross(CD)
cosphi = X.dot(Y) / (abs(X) * abs(Y))
print('{:.2f}'.format(math.degrees(math.acos(cosphi))))


import math

def CrossProduct(v, w):
	return [w[1] * v[2] - w[2] * v[1], w[2] * v[0] - w[0] * v[2], w[0] * v[1] - w[1] * v[0]]

def DotProduct(v, w):
	return v[0] * w[0] + v[1] * w[1] + v[2] * w[2]

def Norm(v):
	return math.sqrt(v[0] ** 2 + v[1] ** 2 + v[2] ** 2)
a = [float(x) for x in input().split()]
b = [float(x) for x in input().split()]
c = [float(x) for x in input().split()]
d = [float(x) for x in input().split()]
ab = [x - y for (x, y) in zip(b, a)]
bc = [x - y for (x, y) in zip(c, b)]
cd = [x - y for (x, y) in zip(d, c)]
x = CrossProduct(ab, bc)
y = CrossProduct(bc, cd)
dot = DotProduct(x, y)
modx = Norm(x)
mody = Norm(y)
temp = dot / (modx * mody)
temp = math.acos(temp)
temp = math.degrees(temp)
print('{0:.2f}'.format(temp))


class Points(object):

	def __init__(self, x, y, z):
		(self.x, self.y, self.z) = (x, y, z)

	def __sub__(self, no):
		return Points(self.x - no.x, self.y - no.y, self.z - no.z)

	def dot(self, no):
		return self.x * no.x + self.y * no.y + self.z * no.z

	def cross(self, no):
		return Points(self.y * no.z - self.z * no.y, self.z * no.x - self.x * no.z, self.y * no.x - self.x * no.y)

	def absolute(self):
		return pow(self.x ** 2 + self.y ** 2 + self.z ** 2, 0.5)


import math

class Point(object):

	def __init__(self, x, y, z):
		self.x = float(x)
		self.y = float(y)
		self.z = float(z)

	def cross_product(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return Point(x, y, z)

	def dot_product(self, other):
		x = self.x * other.x
		y = self.y * other.y
		z = self.z * other.z
		return x + y + z

	def __sub__(self, other):
		x = self.x - other.x
		y = self.y - other.y
		z = self.z - other.z
		return Point(x, y, z)

	def normalize(self):
		return (self.x * self.x + self.y * self.y + self.z * self.z) ** 0.5
A = Point(*input().split())
B = Point(*input().split())
C = Point(*input().split())
D = Point(*input().split())
ab = B - A
bc = C - B
cd = D - C
x = ab.cross_product(bc)
y = bc.cross_product(cd)
r = x.dot_product(y) / (x.normalize() * y.normalize())
print('%.2f' % math.degrees(math.acos(r)))


import math

def dot_product(a, b):
	return sum((x * y for (x, y) in zip(a, b)))

def cross_product(a, b):
	x = a[1] * b[2] - a[2] * b[1]
	y = a[2] * b[0] - a[0] * b[2]
	z = a[0] * b[1] - a[1] * b[0]
	return [x, y, z]

def magnitude(a):
	return math.sqrt(sum((x * x for x in a)))
a = [float(x) for x in input().split()]
b = [float(x) for x in input().split()]
c = [float(x) for x in input().split()]
d = [float(x) for x in input().split()]
ab = [y - x for (x, y) in zip(a, b)]
bc = [y - x for (x, y) in zip(b, c)]
cd = [y - x for (x, y) in zip(c, d)]
X = cross_product(ab, bc)
Y = cross_product(bc, cd)
XY = dot_product(X, Y)
cos_phi = XY / (magnitude(X) * magnitude(Y))
angle_phi = math.degrees(math.acos(cos_phi))
print('{0:.2f}'.format(angle_phi))


from math import sqrt, acos, degrees

class Point:

	def __init__(self, lis):
		self.x = lis[0]
		self.y = lis[1]
		self.z = lis[2]

	def __str__(self):
		return str(self.x) + ' ' + str(self.y) + ' ' + str(self.z)

	def __sub__(self, other):
		x = self.x - other.x
		y = self.y - other.y
		z = self.z - other.z
		return Point([x, y, z])

	def toList(self):
		return [self.x, self.y, self.z]

def cross(v1, v2):
	(x, y, z) = v1
	(a, b, c) = v2
	return [y * c - z * b, z * a - x * c, x * b - y * a]

def dot(v1, v2):
	return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]

def mag(v):
	return sqrt(v[0] ** 2 + v[1] ** 2 + v[2] ** 2)

class Plane:

	def __init__(self, p1, p2, p3):
		self.A = p1
		self.B = p2
		self.C = p3
		self.AB = p2 - p1
		self.AC = p3 - p1

	def angle(self, other):
		X = cross(self.AB.toList(), self.AC.toList())
		Y = cross(other.AB.toList(), other.AC.toList())
		return degrees(acos(dot(X, Y) / (mag(X) * mag(Y))))
A = Point(list(map(float, input().split())))
B = Point(list(map(float, input().split())))
C = Point(list(map(float, input().split())))
D = Point(list(map(float, input().split())))
P1 = Plane(A, B, C)
P2 = Plane(B, C, D)
print('%.2f' % P1.angle(P2))


__author__ = 'peng'
import math

class Vector:

	def __init__(self, x, y, z):
		self._x = x
		self._y = y
		self._z = z

	def dot(self, other):
		return self._x * other._x + self._y * other._y + self._z * other._z

	def cross(self, other):
		term1 = self._y * other._z - self._z * other._y
		term2 = self._z * other._x - self._x * other._z
		term3 = self._x * other._y - self._y * other._x
		return Vector(term1, term2, term3)

	def plan_angle(a, b, c, d):
		x = (b - a).cross(c - b)
		y = (c - b).cross(d - c)
		x_value = math.sqrt(x._x * x._x + x._y * x._y + x._z * x._z)
		y_value = math.sqrt(y._x * y._x + y._y * y._y + y._z * y._z)
		return x.dot(y) / (x_value * y_value)

	def __sub__(self, other):
		return Vector(self._x - other._x, self._y - other._y, self._z - other._z)
(ax, ay, az) = input().split()
(ax, ay, az) = (float(ax), float(ay), float(az))
(bx, by, bz) = input().split()
(bx, by, bz) = (float(bx), float(by), float(bz))
(cx, cy, cz) = input().split()
(cx, cy, cz) = (float(cx), float(cy), float(cz))
(dx, dy, dz) = input().split()
(dx, dy, dz) = (float(dx), float(dy), float(dz))
a = Vector(ax, ay, az)
b = Vector(bx, by, bz)
c = Vector(cx, cy, cz)
d = Vector(dx, dy, dz)
res_radios = Vector.plan_angle(a, b, c, d)
res_degree = math.degrees(math.acos(res_radios))
print('{:.2f}'.format(res_degree))


import math

class point:
	pass

class line:
	pass
A = point()
(A.x, A.y, A.z) = [float(i) for i in input().split()]
B = point()
(B.x, B.y, B.z) = [float(i) for i in input().split()]
C = point()
(C.x, C.y, C.z) = [float(i) for i in input().split()]
D = point()
(D.x, D.y, D.z) = [float(i) for i in input().split()]
AB = line()
(AB.x, AB.y, AB.z) = (B.x - A.x, B.y - A.y, B.z - A.z)
BC = line()
(BC.x, BC.y, BC.z) = (C.x - B.x, C.y - B.y, C.z - B.z)
CD = line()
(CD.x, CD.y, CD.z) = (D.x - C.x, D.y - C.y, D.z - C.z)
X = line()
(X.x, X.y, X.z) = (AB.y * BC.z - AB.z * BC.y, AB.x * BC.z - AB.z * BC.x, AB.x * BC.y - AB.y * BC.x)
Y = line()
(Y.x, Y.y, Y.z) = (BC.y * CD.z - BC.z * CD.y, BC.x * CD.z - BC.z * CD.x, BC.x * CD.y - BC.y * CD.x)
cosphi = (X.x * Y.x + X.y * Y.y + X.z * Y.z) / math.sqrt(X.x ** 2 + X.y ** 2 + X.z ** 2) / math.sqrt(Y.x ** 2 + Y.y ** 2 + Y.z ** 2)
phi = math.acos(cosphi)
print('{:.2f}'.format(math.degrees(phi)))


import math

class Point(object):

	def __init__(self, x=0, y=0, z=0):
		self.pos_x = x
		self.pos_y = y
		self.pos_z = z

	def parse(self, string):
		(self.pos_x, self.pos_y, self.pos_z) = list(map(float, string.split(' ')))
		return self

	def __sub__(self, oth):
		return Point(self.pos_x - oth.pos_x, self.pos_y - oth.pos_y, self.pos_z - oth.pos_z)

	def __abs__(self):
		return math.sqrt(self.pos_x ** 2 + self.pos_y ** 2 + self.pos_z ** 2)

	def dot(self, oth):
		return self.pos_x * oth.pos_x + self.pos_y * oth.pos_y + self.pos_z * oth.pos_z

	def cross(self, oth):
		return Point(self.pos_y * oth.pos_z - self.pos_z * oth.pos_y, self.pos_z * oth.pos_x - self.pos_x * oth.pos_z, self.pos_x * oth.pos_y - self.pos_y * oth.pos_x)

	def __str__(self):
		return 'x: ' + str(self.pos_x) + ' y:' + str(self.pos_y) + ' z:' + str(self.pos_z)

class Plane(object):

	def __init__(self, point1, point2, point3):
		self.point1 = point1
		self.point2 = point2
		self.point3 = point3
		self.X = (self.point2 - self.point1).cross(self.point3 - self.point2)

	def angle(self, oth):
		angle = math.acos(self.X.dot(oth.X) / (abs(self.X) * abs(oth.X)))
		return round(math.degrees(angle), 2)
A = Point().parse(input())
B = Point().parse(input())
C = Point().parse(input())
D = Point().parse(input())
print(Plane(A, B, C).angle(Plane(B, C, D)))


from math import *

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, other):
		return Point(self.x - other.x, self.y - other.y, self.z - other.z)

	def __mul__(self, other):
		return Point(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def __abs__(self):
		return sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

	@staticmethod
	def dot_product(a, b):
		return a.x * b.x + a.y * b.y + a.z * b.z

def solve():
	A = Point(*map(float, input().split()))
	B = Point(*map(float, input().split()))
	C = Point(*map(float, input().split()))
	D = Point(*map(float, input().split()))
	X = (B - A) * (C - B)
	Y = (C - B) * (D - C)
	torsional_angle = degrees(acos(Point.dot_product(X, Y) / abs(X) / abs(Y)))
	print('{0:.2f}'.format(torsional_angle))
solve()


from math import sqrt, acos, degrees

class Point:

	def __init__(self, x, y, z):
		self.x = float(x)
		self.y = float(y)
		self.z = float(z)

	def __mul__(self, other):
		assert isinstance(other, Point), 'only point-point multiplication'
		return self.x * other.x + self.y * other.y + self.z * other.z

	def __sub__(self, other):
		assert isinstance(other, Point), 'only point-point multiplication'
		return Point(self.x - other.x, self.y - other.y, self.z - other.z)

	def cross(self, other):
		return Point(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def __abs__(self):
		t = self * self
		return sqrt(t)

	def __str__(self):
		return 'Point<{}, {}, {}>'.format(self.x, self.y, self.z)
A = Point(*input().split())
B = Point(*input().split())
C = Point(*input().split())
D = Point(*input().split())
X = (A - B).cross(B - C)
Y = (B - C).cross(C - D)
t = X * Y / (abs(X) * abs(Y))
t = degrees(acos(t))
print('{:.2f}'.format(t))


import operator
import math

def cross(p1, p2):
	return [p1[1] * p2[2] - p1[2] * p2[1], p1[2] * p2[0] - p1[0] * p2[2], p1[0] * p2[1] - p1[1] * p2[0]]

def dot(p1, p2):
	return sum(map(operator.mul, p1, p2))

def subtract(a, b):
	return list(map(operator.sub, a, b))

def length(a):
	return math.sqrt(dot(a, a))

def parsePoint(str):
	components = str.split()
	return list(map(float, components))
A = parsePoint(input())
B = parsePoint(input())
C = parsePoint(input())
D = parsePoint(input())
AB = subtract(A, B)
BC = subtract(B, C)
CD = subtract(C, D)
X = cross(AB, BC)
Y = cross(BC, CD)
PHI = math.degrees(math.acos(dot(X, Y) / (length(X) * length(Y))))
print('{0:.2f}'.format(PHI))


import math

def dot(x, y):
	return sum([x[i] * y[i] for i in range(3)])

def abso(x):
	return math.sqrt(sum((x[i] ** 2 for i in range(3))))

def cross(a, b):
	return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]
points = []
for i in range(4):
	points.append(list(map(float, input().split())))
ab = [points[1][i] - points[0][i] for i in range(3)]
bc = [points[2][i] - points[1][i] for i in range(3)]
cd = [points[3][i] - points[2][i] for i in range(3)]
x = cross(ab, bc)
y = cross(bc, cd)
xy = dot(x, y)
x_ = abso(x)
y_ = abso(y)
phi = round(math.degrees(math.acos(xy / (x_ * y_))), 2)
print(phi)


import math

class Vector:

	def __init__(self, x=0, y=0, z=0, t=False):
		self.x = float(x)
		self.y = float(y)
		self.z = float(z)
		self.transposed = t

	def __str__(self):
		out = str('[%.2f, %.2f, %.2f]' % (self.x, self.y, self.z))
		if self.transposed:
			out += "'"
		return out

	def __add__(self, other):
		return Vector(self.x + other.x, self.y + other.y, self.z + other.z)

	def __sub__(self, other):
		return Vector(self.x - other.x, self.y - other.y, self.z - other.z)

	def dot(self, other):
		return float(self.x * other.x + self.y * other.y + self.z * other.z)

	def cross(self, other):
		return Vector(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def __mul__(self, other):
		if self.transposed and (not other.transposed):
			return self.dot(other)
		else:
			raise Exception('Bad vector transponitions')

	def __abs__(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

	def T(self):
		return Vector(self.x, self.y, self.z, not self.transposed)

	def transpose(self):
		self.transposed = not self.transposed
		return self

def read_vector():
	raw = input().strip().split(' ')
	raw = list(filter(None, raw))
	while len(raw) > 3:
		del raw[-1]
	while len(raw) < 3:
		raw.append('0')
	return Vector(raw[0], raw[1], raw[2])
A = read_vector()
B = read_vector()
C = read_vector()
D = read_vector()
X = (B - A).cross(C - B)
Y = (C - B).cross(D - C)
cos_phi = X.dot(Y) / (abs(X) * abs(Y))
phi = math.acos(cos_phi)
print('%.2f' % math.degrees(phi))


import math

def input_vector():
	raw = input()
	v = list(raw.split())
	for i in range(len(v)):
		v[i] = float(v[i])
	return v
a = input_vector()
b = input_vector()
c = input_vector()
d = input_vector()

def minus(a, b):
	return list(map(lambda x, y: x - y, a, b))

def cross(a, b):
	i = a[1] * b[2] - b[1] * a[2]
	j = a[2] * b[0] - b[2] * a[0]
	k = a[0] * b[1] - b[0] * a[1]
	return [i, j, k]
v1 = cross(minus(a, b), minus(c, b))
v2 = cross(minus(b, c), minus(d, c))

def norm(a):
	square = list(map(lambda x: x ** 2, a))
	summation = sum(square)
	return summation ** (1 / 2)

def dot(a, b):
	mult = list(map(lambda x, y: x * y, a, b))
	return sum(mult)
cos = dot(v1, v2) / norm(v1) / norm(v2)
angle = math.degrees(math.acos(cos))
print('%.2f' % angle)


import math

def custom_diff(a, b):
	res0 = a[0] - b[0]
	res1 = a[1] - b[1]
	res2 = a[2] - b[2]
	return [res0, res1, res2]

def dot_product(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

def abs_val(a):
	tmp_val = a[0] * a[0] + a[1] * a[1] + a[2] * a[2]
	return math.sqrt(tmp_val)

def cross(a, b):
	c = [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]
	return c
a_str_ar = input().strip().split()
b_str_ar = input().strip().split()
c_str_ar = input().strip().split()
d_str_ar = input().strip().split()
a = list(map(float, a_str_ar))
b = list(map(float, b_str_ar))
c = list(map(float, c_str_ar))
d = list(map(float, d_str_ar))
ab = custom_diff(b, a)
bc = custom_diff(c, b)
cd = custom_diff(d, c)
x = cross(ab, bc)
y = cross(bc, cd)
cosphi_top = dot_product(x, y)
cosphi_bottom = abs_val(x) * abs_val(y)
cosphi = cosphi_top / cosphi_bottom
res = math.degrees(math.acos(cosphi))
print('%.2f' % res)


from math import *

class pt(object):

	def __init__(self, l):
		self.x = l[0]
		self.y = l[1]
		self.z = l[2]

	def norm(self):
		return sqrt(self.x * self.x + self.y * self.y + self.z * self.z)

def pt_sub(p1, p2):
	return pt([p1.x - p2.x, p1.y - p2.y, p1.z - p2.z])

def pt_cross(p1, p2):
	return pt([p1.y * p2.z - p1.z * p2.y, p1.z * p2.x - p1.x * p2.z, p1.x * p2.y - p1.y * p2.x])

def pt_dot(p1, p2):
	return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z
A = pt(list(map(float, input().split())))
B = pt(list(map(float, input().split())))
C = pt(list(map(float, input().split())))
D = pt(list(map(float, input().split())))
X = pt_cross(pt_sub(A, B), pt_sub(B, C))
Y = pt_cross(pt_sub(B, C), pt_sub(B, D))
phi = degrees(acos(pt_dot(X, Y) / X.norm() / Y.norm()))
print(round(phi, 2))


import math

class Point:

	def __init__(self, x=0, y=0, z=0):
		self.X = x
		self.Y = y
		self.Z = z

	def __add__(self, other):
		return Point(self.X + other.X, self.Y + other.Y, self.Z + other.Z)

	def __sub__(self, other):
		return Point(self.X - other.X, self.Y - other.Y, self.Z - other.Z)

	def __mul__(self, value):
		return Point(self.X * value, self.Y * value, self.Z * value)

	def __floordiv__(self, value):
		return Point(self.X // value, self.Y // value, self.Z // value)

	def __truediv__(self, value):
		return Point(self.X / value, self.Y / value, self.Z / value)

	def __abs__(self):
		return math.sqrt(self.X ** 2 + self.Y ** 2 + self.Z ** 2)

	def __eq__(self, other):
		return self.X == other.X and self.Y == other.Y and (self.Z == other.Z)

	def __ne__(self, other):
		return not self.__eq__(other)

	def dot(self, other):
		return self.X * other.X + self.Y * other.Y + self.Z * other.Z

	def cross(self, other):
		return Point(self.Y * other.Z - other.Y * self.Z, self.Z * other.X - self.X * other.Z, self.X * other.Y - self.Y * other.X)

	def __str__(self):
		return '{:.2f} {:.2f} {:.2f}'.format(self.X, self.Y, self.Z)

	def __repr__(self):
		return str(self)
	pass

def torsionalAngle(A1, B1, C1, B2, C2, D2):
	AB = B1 - A1
	BC = C1 - B1
	CD = D2 - C2
	X = AB.cross(BC)
	Y = BC.cross(CD)
	return math.degrees(math.acos(X.dot(Y) / (abs(X) * abs(Y))))
i = tuple(map(float, input().split()))
p1 = Point(i[0], i[1], i[2])
i = tuple(map(float, input().split()))
p2 = Point(i[0], i[1], i[2])
i = tuple(map(float, input().split()))
p3 = Point(i[0], i[1], i[2])
i = tuple(map(float, input().split()))
p4 = Point(i[0], i[1], i[2])
print('{:.2f}'.format(torsionalAngle(p1, p2, p3, p2, p3, p4)))


import math

class Points(object):

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, end):
		x = self.x - end.x
		y = self.y - end.y
		z = self.z - end.z
		return Points(x, y, z)

	def dot(self, other):
		x = self.x * other.x
		y = self.y * other.y
		z = self.z * other.z
		return x + y + z

	def cross(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return Points(x, y, z)

	def absolute_scale(self):
		return pow(self.x ** 2 + self.y ** 2 + self.z ** 2, 0.5)

def solve(A, B, C, D):
	(A, B, C, D) = (Points(*A), Points(*B), Points(*C), Points(*D))
	X = (B - A).cross(C - B)
	Y = (C - B).cross(D - C)
	phi = math.acos(X.dot(Y) / (X.absolute_scale() * Y.absolute_scale()))
	print('%.2f' % math.degrees(phi))
points = []
for i in range(4):
	point = list(map(float, input().split()))
	points.append(point)
solve(*points)


from math import sqrt, acos, degrees
a = tuple((float(i) for i in input().split()))
b = tuple((float(i) for i in input().split()))
c = tuple((float(i) for i in input().split()))
d = tuple((float(i) for i in input().split()))

def cross(x, y):
	return (x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0])

def dot(x, y):
	return x[0] * y[0] + x[1] * y[1] + x[2] * y[2]

def magn(x):
	return sqrt(x[0] ** 2 + x[1] ** 2 + x[2] ** 2)
(ab, bc, cd) = (tuple((x - y for (x, y) in zip(b, a))), tuple((x - y for (x, y) in zip(c, b))), tuple((x - y for (x, y) in zip(d, c))))
(x, y) = (cross(ab, bc), cross(bc, cd))
(num, denom) = (dot(x, y), magn(x) * magn(y))
print('{0:.2f}'.format(degrees(acos(num / denom))))


from math import *
A = [float(x) for x in input().split()]
B = [float(x) for x in input().split()]
C = [float(x) for x in input().split()]
D = [float(x) for x in input().split()]

def DP(A, B):
	return sum((A[i] * B[i] for i in range(len(A))))

def CP(A, B):
	return [A[(i + 1) % len(A)] * B[(i + 2) % len(A)] - A[(i + 2) % 3] * B[(i + 1) % len(A)] for i in range(len(A))]

def ABS(A):
	return sqrt(sum((i * i for i in A)))

def VEC(A, B):
	return [B[i] - A[i] for i in range(len(A))]
AB = VEC(A, B)
BC = VEC(B, C)
CD = VEC(C, D)
X = CP(AB, BC)
Y = CP(BC, CD)
print('%.2f' % (acos(DP(X, Y) / ABS(X) / ABS(Y)) / pi * 180))


import math

def minus(A, B):
	return [B[0] - A[0], B[1] - A[1], B[2] - A[2]]

def length(A):
	return math.sqrt(A[0] * A[0] + A[1] * A[1] + A[2] * A[2])

def crossProduct(A, B):
	return [A[1] * B[2] - A[2] * B[1], A[2] * B[0] - A[0] * B[2], A[0] * B[1] - A[1] * B[0]]

def dotProduct(A, B):
	return sum((p * q for (p, q) in zip(A, B)))
A = input()
A = list(map(float, A.rstrip('\n').split(' ')))
B = input()
B = list(map(float, B.rstrip('\n').split(' ')))
C = input()
C = list(map(float, C.rstrip('\n').split(' ')))
D = input()
D = list(map(float, D.rstrip('\n').split(' ')))
AB = minus(A, B)
BC = minus(B, C)
CD = minus(C, D)
X = crossProduct(AB, BC)
Y = crossProduct(BC, CD)
ans = math.acos(dotProduct(X, Y) / (length(X) * length(Y)))
degree = ans * (180 / math.pi)
print('%.2f' % (degree % 360))


import math

class Vector:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __add__(self, other):
		return Vector(self.x + other.x, self.y + other.y, self.z + other.z)

	def __sub__(self, other):
		return Vector(self.x - other.x, self.y - other.y, self.z - other.z)

	def __mul__(self, other):
		x = self.y * other.z - other.y * self.z
		y = self.z * other.x - other.z * self.x
		z = self.x * other.y - other.x * self.y
		return Vector(x, y, z)

	def mod(self):
		return math.sqrt(self.dot(self))

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def angle(self, other):
		return math.acos(self.dot(other) / (self.mod() * other.mod())) * 180 / math.pi
a = Vector(*list(map(float, input().split())))
b = Vector(*list(map(float, input().split())))
c = Vector(*list(map(float, input().split())))
d = Vector(*list(map(float, input().split())))
x = (b - a) * (c - b)
y = (c - b) * (d - c)
print('%.2f' % x.angle(y))


from math import acos, pi
p = []
for i in range(4):
	p.append(list(map(float, input().split())))

def cross(x, y):
	return [x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0]]

def dot(x, y):
	return sum([x[i] * y[i] for i in range(len(x))])

def length(x):
	return sum([a * a for a in x]) ** 0.5

def minus(x, y):
	return [x[i] - y[i] for i in range(len(x))]
X = cross(minus(p[1], p[0]), minus(p[2], p[1]))
Y = cross(minus(p[2], p[1]), minus(p[3], p[2]))
print('%.2f' % (acos(dot(X, Y) / length(X) / length(Y)) / pi * 180))


from math import acos, degrees, sqrt

class Vector3D(object):

	def __init__(self, x, y, z):
		super(Vector3D, self).__init__()
		self.x = x
		self.y = y
		self.z = z

	def __add__(self, other):
		return Vector3D(self.x + other.x, self.y + other.y, self.z + other.z)

	def __mul__(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def __sub__(self, other):
		return Vector3D(self.x - other.x, self.y - other.y, self.z - other.z)

	def __pow__(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return Vector3D(x, y, z)

	def __abs__(self):
		return sqrt(self * self)

	def __xor__(self, other):
		return self * other / abs(self) / abs(other)
tuples = (tuple(map(float, input().strip().split())) for _ in range(4))
(a, b, c, d) = [Vector3D(*t) for t in tuples]
(ab, bc, cd) = (b - a, c - b, d - c)
(x, y) = (ab ** bc, bc ** cd)
print('{:.2f}'.format(degrees(acos(x ^ y))))


from math import acos, degrees, pow, sqrt

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def cross(self, other):
		return Point(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def length(self):
		return sqrt(pow(self.x, 2) + pow(self.y, 2) + pow(self.z, 2))

	def __sub__(self, other):
		return Point(self.x - other.x, self.y - other.y, self.z - other.z)
points = []
for j in range(4):
	(Px, Py, Pz) = map(float, input().split())
	points.append(Point(Px, Py, Pz))
AB = points[1] - points[0]
BC = points[2] - points[1]
CD = points[3] - points[2]
X = AB.cross(BC)
Y = BC.cross(CD)
angle = round(degrees(acos(X.dot(Y) / (X.length() * Y.length()))), 2)
print(angle)


from math import *

def dot(P, Q):
	return sum([i * j for (i, j) in zip(P, Q)])
A = [float(_) for _ in input().split()]
B = [float(_) for _ in input().split()]
C = [float(_) for _ in input().split()]
D = [float(_) for _ in input().split()]
AB = [i - j for (i, j) in zip(A, B)]
BC = [i - j for (i, j) in zip(B, C)]
CD = [i - j for (i, j) in zip(C, D)]
X = [AB[1] * BC[2] - AB[2] * BC[1], AB[2] * BC[0] - AB[0] * BC[2], AB[0] * BC[1] - AB[1] * BC[0]]
Y = [BC[1] * CD[2] - BC[2] * CD[1], BC[2] * CD[0] - BC[0] * CD[2], BC[0] * CD[1] - BC[1] * CD[0]]
PHI = degrees(acos(dot(X, Y) / (sqrt(dot(X, X)) * sqrt(dot(Y, Y)))))
print('{0:.2f}'.format(PHI))


import math

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z
		return

	def __add__(self, other):
		ab = self.x + other.x
		bc = self.y + other.y
		cd = self.z + other.z
		return Point(ab, bc, cd)

	def __sub__(self, other):
		ab = self.x - other.x
		bc = self.y - other.y
		cd = self.z - other.z
		return Point(ab, bc, cd)

	def __mul__(self, other):
		a1 = self.x
		a2 = self.y
		a3 = self.z
		b1 = other.x
		b2 = other.y
		b3 = other.z
		return Point(a2 * b3 - a3 * b2, -(a1 * b3 - a3 * b1), a1 * b2 - a2 * b1)

	def dotp(self, other):
		a1 = self.x
		a2 = self.y
		a3 = self.z
		b1 = other.x
		b2 = other.y
		b3 = other.z
		return a1 * b1 + a2 * b2 + a3 * b3

	def mod(self):
		a1 = self.x
		a2 = self.y
		a3 = self.z
		return math.sqrt(a1 * a1 + a2 * a2 + a3 * a3)
tp = str(input())
xyz = tp.split()
A = Point(float(xyz[0]), float(xyz[1]), float(xyz[2]))
tp = str(input())
xyz = tp.split()
B = Point(float(xyz[0]), float(xyz[1]), float(xyz[2]))
tp = str(input())
xyz = tp.split()
C = Point(float(xyz[0]), float(xyz[1]), float(xyz[2]))
tp = str(input())
xyz = tp.split()
D = Point(float(xyz[0]), float(xyz[1]), float(xyz[2]))
AB = B - A
BC = C - B
CD = D - C
X = AB * BC
Y = BC * CD
xm = X.mod()
ym = Y.mod()
up = X.dotp(Y)
down = xm * ym
rad = math.acos(up / down)
ans = math.degrees(rad)
print('%.2f ' % ans)


from math import sqrt, acos, degrees

def diff(p, q):
	return [q[i] - p[i] for i in range(3)]

def cross_product(u, v):
	return [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]]

def dot_product(u, v):
	return sum([u[i] * v[i] for i in range(3)])

def length(v):
	return sqrt(dot_product(v, v))
(A, B, C, D) = [[float(i) for i in input().split()] for _ in range(4)]
AB = diff(A, B)
BC = diff(B, C)
CD = diff(C, D)
X = cross_product(AB, BC)
Y = cross_product(BC, CD)
cos_phi = dot_product(X, Y) / (length(X) * length(Y))
phi = degrees(acos(cos_phi))
print('{:.2f}'.format(phi))


from math import acos
from math import degrees

def dot(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

def cross(a, b):
	x = a[1] * b[2] - a[2] * b[1]
	y = a[2] * b[0] - a[0] * b[2]
	z = a[0] * b[1] - a[1] * b[0]
	return [x, y, z]

def vector(a, b):
	return [b[0] - a[0], b[1] - a[1], b[2] - a[2]]

def veclen(a):
	return (a[0] ** 2 + a[1] ** 2 + a[2] ** 2) ** 0.5
point = {}
lists = ['A', 'B', 'C', 'D']
for i in lists:
	(x, y, z) = map(float, input().split())
	point[i] = [x, y, z]
AB = vector(point['A'], point['B'])
BC = vector(point['B'], point['C'])
CD = vector(point['C'], point['D'])
X = cross(AB, BC)
Y = cross(BC, CD)
cosphi = dot(X, Y) / (veclen(X) * veclen(Y))
print('{0:.2f}'.format(degrees(acos(cosphi))))


import math

def vector(a, b):
	return [b[i] - a[i] for i in range(3)]

def cross(u, v):
	return [u[(i + 1) % 3] * v[(i + 2) % 3] - u[(i + 2) % 3] * v[(i + 1) % 3] for i in range(3)]

def dot(u, v):
	sum = 0.0
	for dirs in range(3):
		sum += u[dirs] * v[dirs]
	return sum

def absvec(u):
	sum = 0.0
	for dirs in range(3):
		sum += u[dirs] ** 2
	return sum ** 0.5
points = []
for pt in range(4):
	strpt = str(input()).split(' ')
	fltpt = list(map(float, strpt))
	points.append(fltpt)
AB = vector(points[0], points[1])
BC = vector(points[1], points[2])
CD = vector(points[2], points[3])
XCR = cross(AB, BC)
YCR = cross(BC, CD)
COS = dot(XCR, YCR) / (absvec(XCR) * absvec(YCR))
print('{0:.2f}'.format(180 * math.acos(COS) / math.pi))


import math

class Point(object):

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

class Vector(object):

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	@classmethod
	def from_points(Vector, begin, end):
		return Vector(end.x - begin.x, end.y - begin.y, end.z - begin.z)

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def cross(self, other):
		return Vector(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def magnitude(self):
		return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z)

class Plane(object):

	def __init__(self, a, b, c):
		self.v = Vector.from_points(a, b)
		self.w = Vector.from_points(b, c)

	def angle(self, other):
		x = self.v.cross(self.w)
		y = other.v.cross(other.w)
		mx = x.magnitude()
		my = y.magnitude()
		cos_phi = x.dot(y) / (mx * my)
		phi_rad = math.acos(cos_phi)
		phi_deg = phi_rad * 180.0 / math.pi
		return phi_deg
coords = [float(n) for n in input().split()]
a = Point(*coords)
coords = [float(n) for n in input().split()]
b = Point(*coords)
coords = [float(n) for n in input().split()]
c = Point(*coords)
coords = [float(n) for n in input().split()]
d = Point(*coords)
p1 = Plane(a, b, c)
p2 = Plane(b, c, d)
phi = p1.angle(p2)
print('{0:.2f}'.format(phi))


import math

class Cartesian:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def cross(self, other):
		ax = self.x
		ay = self.y
		az = self.z
		bx = other.x
		by = other.y
		bz = other.z
		return Cartesian(ay * bz - az * by, -ax * bz + az * bx, ax * by - ay * bx)

	def dot(self, other):
		ax = self.x
		ay = self.y
		az = self.z
		bx = other.x
		by = other.y
		bz = other.z
		return ax * bx + ay * by + az * bz

	def line_seg(self, other):
		return Cartesian(other.x - self.x, other.y - self.y, other.z - self.z)

	def magnitude(self):
		return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z)

	def angle(self, b, c, d):
		AB = Cartesian.line_seg(self, b)
		BC = Cartesian.line_seg(b, c)
		CD = Cartesian.line_seg(c, d)
		X = Cartesian.cross(AB, BC)
		Y = Cartesian.cross(BC, CD)
		XdotY = Cartesian.dot(X, Y)
		magX = Cartesian.magnitude(X)
		magY = Cartesian.magnitude(Y)
		phi = math.acos(XdotY / magX / magY)
		return round(math.degrees(phi), 2)

	def __str__(self):
		return '(%g, %g, %g)' % (self.x, self.y, self.z)
a_in = input().split()
b_in = input().split()
c_in = input().split()
d_in = input().split()
a = Cartesian(float(a_in[0]), float(a_in[1]), float(a_in[2]))
b = Cartesian(float(b_in[0]), float(b_in[1]), float(b_in[2]))
c = Cartesian(float(c_in[0]), float(c_in[1]), float(c_in[2]))
d = Cartesian(float(d_in[0]), float(d_in[1]), float(d_in[2]))
print(Cartesian.angle(a, b, c, d))


import math

class Vector(object):
	x = 0
	y = 0
	z = 0

	def __init__(self, x=0, y=0, z=0):
		self.x = x
		self.y = y
		self.z = z

	def __str__(self):
		return '(%f,%f,%f)' % (self.x, self.y, self.z)

	def dotProduct(self, vec2):
		result = self.x * vec2.x + self.y * vec2.y + self.z * vec2.z
		return result

	def crossProduct(self, vec2):
		xf = self.y * vec2.z - vec2.y * self.z
		yf = -(self.x * vec2.z - vec2.x * self.z)
		zf = self.x * vec2.y - vec2.x * self.y
		resvec = Vector(xf, yf, zf)
		return resvec

	def modulus(self):
		return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z)

	def line(self, vec2):
		return Vector(self.x - vec2.x, self.y - vec2.y, self.z - vec2.z)
T = tuple(map(float, input().split()))
A = Vector(*T)
T = tuple(map(float, input().split()))
B = Vector(*T)
T = tuple(map(float, input().split()))
C = Vector(*T)
T = tuple(map(float, input().split()))
D = Vector(*T)
AB = A.line(B)
BC = B.line(C)
X = AB.crossProduct(BC)
CD = C.line(D)
Y = BC.crossProduct(CD)
cos_phi = X.dotProduct(Y) / (X.modulus() * Y.modulus())
phi = math.acos(cos_phi) * 180 / math.pi
print('%.2f' % phi)


t = []
for i in range(4):
	t.append(input().split(' '))
s = []
for i in range(4):
	k = []
	for j in range(3):
		k.append(float(t[i][j]))
	s.append(k)

def myline(s1, s2):
	result = []
	for i in range(3):
		result.append(s1[i] - s2[i])
	return result
AB = myline(s[1], s[0])
BC = myline(s[2], s[1])
CD = myline(s[3], s[2])

def crossproduct(s1, s2):
	result = []
	result.append(s1[1] * s2[2] - s1[2] * s2[1])
	result.append(s1[2] * s2[0] - s1[0] * s2[2])
	result.append(s1[0] * s2[1] - s1[1] * s2[0])
	return result
X = crossproduct(AB, BC)
Y = crossproduct(BC, CD)

def dotproduct(s1, s2):
	k = 0
	for i in range(3):
		k += s1[i] * s2[i]
	return k
import math

def length(s1):
	k = 0
	for i in range(3):
		k += s1[i] * s1[i]
	return math.sqrt(k)
PHI = dotproduct(X, Y) / (length(X) * length(Y))
print('%.2f' % (180 * math.acos(PHI) / math.pi))


import math

class Point(object):

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

class Vector(object):

	def __init__(self, a=Point(0, 0, 0), b=Point(1, 0, 0)):
		self.x = b.x - a.x
		self.y = b.y - a.y
		self.z = b.z - a.z

	def __repr__(self):
		return '(%f, %f, %f)' % (self.x, self.y, self.z)

	def dot(self, vecb):
		return self.x * vecb.x + self.y * vecb.y + self.z * vecb.z

	def cross(self, vecb):
		x = self.y * vecb.z - self.z * vecb.y
		y = self.z * vecb.x - self.x * vecb.z
		z = self.x * vecb.y - self.y * vecb.x
		return Vector(b=Point(x, y, z))

	def magnitude(self):
		return math.sqrt(self.dot(self))
pointa = Point(*map(float, input().split(' ')))
pointb = Point(*map(float, input().split(' ')))
pointc = Point(*map(float, input().split(' ')))
pointd = Point(*map(float, input().split(' ')))
vecab = Vector(pointa, pointb)
vecbc = Vector(pointb, pointc)
veccd = Vector(pointc, pointd)
planevec1 = vecab.cross(vecbc)
planevec2 = vecbc.cross(veccd)
direction = planevec1.dot(planevec2) / (planevec1.magnitude() * planevec2.magnitude())
angle = math.acos(direction)
angledegrees = 180.0 * angle / math.pi
print('{0:.2f}'.format(angledegrees))


import math

class point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z
		return

	def __line__(self, other):
		x = other.x - self.x
		y = other.y - self.y
		z = other.z - self.z
		return point(x, y, z)

	def __cross_product__(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return point(x, y, z)

	def __dot_product__(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def __abs__(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

	def __str__(self):
		return '%g, %g, %g' % (self.x, self.y, self.z)
l1 = input().strip().split(' ')
l2 = input().strip().split(' ')
l3 = input().strip().split(' ')
l4 = input().strip().split(' ')
l1 = list(map(float, l1))
l2 = list(map(float, l2))
l3 = list(map(float, l3))
l4 = list(map(float, l4))
p1 = point(l1[0], l1[1], l1[2])
p2 = point(l2[0], l2[1], l2[2])
p3 = point(l3[0], l3[1], l3[2])
p4 = point(l4[0], l4[1], l4[2])
AB = p1.__line__(p2)
BC = p2.__line__(p3)
CD = p3.__line__(p4)
X = AB.__cross_product__(BC)
Y = BC.__cross_product__(CD)
result = X.__dot_product__(Y) / (X.__abs__() * Y.__abs__())
print('{0:.2f}'.format(math.degrees(math.acos(result))))


import math

def cross(a, b):
	c = [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]
	return c

def dot(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

def mag(a):
	return math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2])

def vec(a, b):
	vector = []
	for i in range(3):
		vector.append(float(b[i]) - float(a[i]))
	return vector
points = []
for i in range(4):
	side = input()
	side = side.split()
	points.append(side)
angle = 0
AB = vec(points[1], points[0])
BC = vec(points[2], points[1])
CD = vec(points[3], points[2])
X = cross(AB, BC)
Y = cross(BC, CD)
cosPHI = dot(X, Y) / (mag(X) * mag(Y))
PHI = math.acos(cosPHI)
print('{0:.2f}'.format(math.degrees(PHI)))


import math

class P:

	def __init__(self, x, y, z):
		(self.x, self.y, self.z) = (x, y, z)

	def __add__(self, other):
		return P(self.x + other.x, self.y + other.y, self.z + other.z)

	def __sub__(self, other):
		return P(self.x - other.x, self.y - other.y, self.z - other.z)

	def __mul__(self, other):
		return P(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def __str__(self):
		return '%.02f %.02f %.02f' % (self.x, self.y, self.z)

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def abs(self):
		return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5

def readP():
	(x, y, z) = map(float, input().split())
	return P(x, y, z)
[A, B, C, D] = [readP() for i in range(4)]
(X, Y) = ((B - A) * (C - B), (C - B) * (D - C))
cosPhi = X.dot(Y) / (X.abs() * Y.abs())
print('%.02lf' % (math.acos(cosPhi) / math.pi * 180))


import math

def cross(v1, v2):
	return [v1[1] * v2[2] - v2[1] * v1[2], v2[0] * v1[2] - v2[2] * v1[0], v1[0] * v2[1] - v2[0] * v1[1]]

def dot(v1, v2):
	return sum((v1[k] * v2[k] for k in range(3)))

def diff(v1, v2):
	return [v1[k] - v2[k] for k in range(3)]

def norm(v):
	return math.sqrt(sum((v[k] ** 2.0 for k in range(len(v)))))
(A, B, C, D) = ([float(el) for el in str(input()).split(' ')] for k in range(4))
X = cross(diff(A, B), diff(B, C))
Y = cross(diff(B, C), diff(C, D))
cos_phi = dot(X, Y) / (norm(X) * norm(Y))
print('%.2f' % (math.acos(cos_phi) * 360 / (2 * math.pi)))


from math import acos, degrees, sqrt

class point:
	__slots__ = ('x', 'y', 'z')

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __abs__(self):
		return sqrt(self.x * self.x + self.y * self.y + self.z * self.z)

	def __add__(self, o):
		return point(self.x + o.x, self.y + o.y, self.z + o.z)

	def __sub__(self, o):
		return point(self.x - o.x, self.y - o.y, self.z - o.z)

	def __mul__(self, o):
		return self.x * o.x + self.y * o.y + self.z * o.z

	def __mod__(self, o):
		return point(self.y * o.z - self.z * o.y, self.z * o.x - self.x * o.z, self.x * o.y - self.y * o.x)

def torsionangle(a, b, c, d):
	x = (b - a) % (c - b)
	y = (c - b) % (d - c)
	return degrees(acos(x * y / (abs(x) * abs(y))))
a = point(*map(float, input().split()))
b = point(*map(float, input().split()))
c = point(*map(float, input().split()))
d = point(*map(float, input().split()))
print('{:.2f}'.format(torsionangle(a, b, c, d)))


import math, sys

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __abs__(self):
		return (self.x * self.x + self.y * self.y + self.z * self.z) ** 0.5

	def __add__(self, other):
		return Point(self.x + other.x, self.y + other.y, self.z + other.z)

	def __sub__(self, other):
		return Point(self.x - other.x, self.y - other.y, self.z - other.z)

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def cross(self, other):
		return Point(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)
A = Point(*list(map(float, sys.stdin.readline().split())))
B = Point(*list(map(float, sys.stdin.readline().split())))
C = Point(*list(map(float, sys.stdin.readline().split())))
D = Point(*list(map(float, sys.stdin.readline().split())))
X = (A - B).cross(B - C)
Y = (B - C).cross(C - D)
print('%.2f' % math.degrees(math.acos(X.dot(Y) / abs(X) / abs(Y))))


class DimensionError(Exception):
	pass
import math

class Vector(object):

	def __init__(self, x=None, dim=2, *args):
		self.li = x if x else [1 for _ in range(dim)]
		if args:
			self.li.extend(args)
		self.dim = len(self.li)

	def __mul__(self, other):
		if not isinstance(other, Vector):
			raise TypeError('Wrong argument type')
		if self.dim != other.dim:
			raise DimensionError('Wrong dimenstions')

	def __getitem__(self, index):
		return self.li.__getitem__(index)

	def __setitem__(self, index, item):
		return self.li.__setitem__(index, item)

	def dot(self, other):
		return sum((x * y for (x, y) in zip(self.li, other.li)))

	def cross(self, other):
		new_vec = Vector(dim=self.dim)
		new_vec[0] = self.li[1] * other[2] - self.li[2] * other[1]
		new_vec[1] = -(self.li[0] * other[2]) + self.li[2] * other[0]
		new_vec[2] = self.li[0] * other[1] - self.li[1] * other[0]
		return new_vec

	def __str__(self):
		return self.li.__str__()

	def meg(self):
		return math.sqrt(sum((x ** 2 for x in self.li)))

	def __sub__(self, other):
		new_vec = Vector(dim=self.dim)
		for i in range(self.dim):
			new_vec[i] = self[i] - other[i]
		return new_vec
(A, B, C, D) = [Vector([float(x) for x in input().split()]) for i in range(4)]
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
print(round(math.acos(X.dot(Y) / (X.meg() * Y.meg())) * (180 / math.pi), 2))


import math

def get_cor():
	return list(map(float, input().split()))

def get_vec(cor1, cor2):
	return [cor2[i] - cor1[i] for i in range(3)]

def cross(cor1, cor2):
	return [cor1[1] * cor2[2] - cor1[2] * cor2[1], cor1[2] * cor2[0] - cor1[0] * cor2[2], cor1[0] * cor2[1] - cor1[1] * cor2[0]]

def dot(cor1, cor2):
	return sum([cor1[i] * cor2[i] for i in range(3)])

def get_len(cor):
	sq_sum = sum([i ** 2 for i in cor])
	return math.sqrt(sq_sum)
[A, B, C, D] = [get_cor() for _ in range(4)]
AB = get_vec(A, B)
BC = get_vec(B, C)
CD = get_vec(C, D)
X = cross(AB, BC)
Y = cross(BC, CD)
cos_val = dot(X, Y) / get_len(X) / get_len(Y)
phi = math.acos(cos_val)
print('%.2f' % math.degrees(phi))


import math
conversao = 57.2957795

class Calculadora:

	def SubtraiPontos(self, a, b):
		return [b[0] - a[0], b[1] - a[1], b[2] - a[2]]

	def ProdutoCruzado(self, a, b):
		return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]

	def ProdutoEscalar(self, a, b):
		return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

	def Modulo(self, a):
		return math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2])
a = list(map(float, input().split(' ')))
b = list(map(float, input().split(' ')))
c = list(map(float, input().split(' ')))
d = list(map(float, input().split(' ')))
calculadora = Calculadora()
ab = calculadora.SubtraiPontos(b, a)
bc = calculadora.SubtraiPontos(c, b)
cd = calculadora.SubtraiPontos(d, c)
x = calculadora.ProdutoCruzado(bc, ab)
y = calculadora.ProdutoCruzado(cd, bc)
cos_angulo = calculadora.ProdutoEscalar(x, y) / (calculadora.Modulo(x) * calculadora.Modulo(y))
angulo = math.acos(cos_angulo)
print('%.2f' % (angulo * conversao))


__author__ = 'nolanemirot'
import math

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, other):
		xx = self.x - other.x
		yy = self.y - other.y
		zz = self.z - other.z
		return Point(xx, yy, zz)

	def __mul__(self, other):
		xx = self.y * other.z - self.z * other.y
		yy = self.z * other.x - self.x * other.z
		zz = self.x * other.y - self.y * other.x
		return Point(xx, yy, zz)

	def dot(self, other):
		xx = self.x * other.x
		yy = self.y * other.y
		zz = self.z * other.z
		return xx + yy + zz

	def absolute_val(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
(ax, ay, az) = map(float, input().split())
a = Point(ax, ay, az)
(bx, by, bz) = map(float, input().split())
b = Point(bx, by, bz)
(cx, cy, cz) = map(float, input().split())
c = Point(cx, cy, cz)
(cx, cy, cz) = map(float, input().split())
d = Point(cx, cy, cz)
X = (b - a) * (c - b)
Y = (c - b) * (d - c)
A = X * Y
XX = X.absolute_val()
YY = Y.absolute_val()
res = X.dot(Y) / (XX * YY)
res = math.acos(res)
print('%.2f' % math.degrees(res))


import math

def str2float(my_list):
	result = []
	for item in my_list:
		result.append(float(item))
	return result

def minus(A, B):
	result = []
	for i in range(len(A)):
		result.append(A[i] - B[i])
	return result

def dot_mul(x, y):
	len_x = len(x)
	result = 0
	for i in range(len_x):
		result += x[i] * y[i]
	return result

def cross_mul(x, y):
	result = [0, 0, 0]
	result[0] = x[1] * y[2] - y[1] * x[2]
	result[1] = x[2] * y[0] - x[0] * y[2]
	result[2] = x[0] * y[1] - y[0] * x[1]
	return result

def my_abs(x):
	result = 0
	for item in x:
		result += item ** 2
	return math.sqrt(result)
A = str2float(input().split())
B = str2float(input().split())
C = str2float(input().split())
D = str2float(input().split())
AB = minus(B, A)
BC = minus(C, B)
CD = minus(D, C)
X = cross_mul(AB, BC)
Y = cross_mul(BC, CD)
COS_PHI = dot_mul(X, Y) / (my_abs(X) * my_abs(Y))
Phi = math.acos(COS_PHI) / math.pi * 180
print('%0.2f' % Phi)


import math

class Vector3D:

	def __init__(self, x=0, y=0, z=0):
		self.x = x
		self.y = y
		self.z = z

	def __str__(self):
		return '(%f, %f, %f)' % (self.x, self.y, self.z)

	def __add__(self, other):
		return Vector3D(self.x + other.x, self.y + other.y, self.z + other.z)

	def __sub__(self, other):
		return Vector3D(self.x - other.x, self.y - other.y, self.z - other.z)

	def __mul__(self, other):
		return Vector3D(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

	def dot_prod(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def mod(self):
		return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z)

def main():
	line = list(map(float, input().split()))
	A = Vector3D(line[0], line[1], line[2])
	line = list(map(float, input().split()))
	B = Vector3D(line[0], line[1], line[2])
	line = list(map(float, input().split()))
	C = Vector3D(line[0], line[1], line[2])
	line = list(map(float, input().split()))
	D = Vector3D(line[0], line[1], line[2])
	X = (B - A) * (C - B)
	Y = (C - B) * (D - C)
	cos_phi = X.dot_prod(Y) / (X.mod() * Y.mod())
	phi = math.acos(cos_phi) * 180 / math.pi
	print('%.2f' % phi)
main()


import math
A = [float(x) for x in input().split()]
B = [float(x) for x in input().split()]
C = [float(x) for x in input().split()]
D = [float(x) for x in input().split()]
AB = [x - y for (x, y) in zip(B, A)]
BC = [x - y for (x, y) in zip(C, B)]
CD = [x - y for (x, y) in zip(D, C)]

def cross(left, right):
	x = left[1] * right[2] - left[2] * right[1]
	y = left[2] * right[0] - left[0] * right[2]
	z = left[0] * right[1] - left[1] * right[0]
	return [x, y, z]

def dot(left, right):
	x = left[0] * right[0]
	y = left[1] * right[1]
	z = left[2] * right[2]
	return x + y + z

def mod(left):
	return math.sqrt(left[0] ** 2 + left[1] ** 2 + left[2] ** 2)
X = cross(AB, BC)
Y = cross(BC, CD)
dot = dot(X, Y)
modX = mod(X)
modY = mod(Y)
temp = math.acos(dot / (modX * modY))
temp = math.degrees(temp)
output = '{:.2f}'.format(temp)
print(float(output))


import math

class P:

	def __init__(self, x, y, z):
		self.x = float(x)
		self.y = float(y)
		self.z = float(z)

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def cross(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return P(x, y, z)

	def __sub__(self, other):
		x = self.x - other.x
		y = self.y - other.y
		z = self.z - other.z
		return P(x, y, z)

	def mag(self):
		return (self.x * self.x + self.y * self.y + self.z * self.z) ** 0.5

	def __repr__(self):
		return '{:.2f} {:.2f} {:.2f}'.format(self.x, self.y, self.z)
A = P(*tuple(input().split()))
B = P(*tuple(input().split()))
C = P(*tuple(input().split()))
D = P(*tuple(input().split()))
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
phi = math.degrees(math.acos(X.dot(Y) / (X.mag() * Y.mag())))
print('{:.2f}'.format(phi))


import math

def parsePoint():
	return list(map(float, input().split()))
a = parsePoint()
b = parsePoint()
c = parsePoint()
d = parsePoint()
AB = []
BC = []
CD = []
for x in range(3):
	AB.append(a[x] - b[x])
	BC.append(b[x] - c[x])
	CD.append(c[x] - d[x])

def abso(x):
	return (x[0] ** 2 + x[1] ** 2 + x[2] ** 2) ** 0.5

def dot(x, y):
	return x[0] * y[0] + x[1] * y[1] + x[2] * y[2]

def cross(v, w):
	(x, y, z) = v
	(a, b, c) = w
	return [y * c - z * b, z * a - x * c, x * b - y * a]
X = cross(AB, BC)
Y = cross(BC, CD)
print('%.2f' % math.degrees(math.acos(dot(X, Y) / (abso(X) * abso(Y)))))


import math

class Point:

	def __init__(self, *args):
		self.x = args[0][0]
		self.y = args[0][1]
		self.z = args[0][2]

	def __str__(self):
		return '({0},{1},{2})'.format(self.x, self.y, self.z)

	def __div__(self, Rhs):
		return Point(self.x / Rhs, self.y / Rhs, self.z / Rhs)

	def __sub__(self, Rhs):
		return Point([self.x - Rhs.x, self.y - Rhs.y, self.z - Rhs.z])

	def cross(self, Rhs):
		a = self.y * Rhs.z - self.z * Rhs.y
		b = self.z * Rhs.x - self.x * Rhs.z
		c = self.x * Rhs.y - self.y * Rhs.x
		return Point([a, b, c])

	def dot(self, Rhs):
		return self.x * Rhs.x + self.y * Rhs.y + self.z * Rhs.z

	def mag(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
pta = Point(list(map(float, input().strip().split(' '))))
ptb = Point(list(map(float, input().strip().split(' '))))
ptc = Point(list(map(float, input().strip().split(' '))))
ptd = Point(list(map(float, input().strip().split(' '))))
X = (pta - ptb).cross(ptb - ptc)
Y = (ptb - ptc).cross(ptc - ptd)
cos_phi = X.dot(Y) / (X.mag() * Y.mag())
print(round(math.degrees(math.acos(cos_phi)), 2))


from math import acos, degrees

class PointVector:

	def __init__(self, dims):
		self.dims = dims

	def __str__(self):
		return str(self.dims)

	def __sub__(self, sub):
		return PointVector([a - b for (a, b) in zip(self.dims, sub.dims)])

	def cross(self, other):
		u = self.dims
		v = other.dims
		return PointVector([u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]])

	def dot(self, other):
		return sum([a * b for (a, b) in zip(self.dims, other.dims)])

	def magnitude(self):
		return self.dot(self) ** 0.5

def get_point():
	return PointVector(list(map(float, input().split())))
A = get_point()
B = get_point()
C = get_point()
D = get_point()
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
cosPHI = X.dot(Y) / (X.magnitude() * Y.magnitude())
print('{:.2f}'.format(degrees(acos(cosPHI))))


import math

class Point(object):

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, point):
		x = self.x - point.x
		y = self.y - point.y
		z = self.z - point.z
		return Point(x, y, z)

	def dot(self, point):
		x = self.x * point.x
		y = self.y * point.y
		z = self.z * point.z
		return x + y + z

	def cross(self, point):
		x = self.y * point.z - self.z * point.y
		y = self.z * point.x - self.x * point.z
		z = self.x * point.y - self.y * point.x
		return Point(x, y, z)

	def absolute(self):
		return pow(self.x ** 2 + self.y ** 2 + self.z ** 2, 0.5)

def calc_angle(a, b, c, d):
	(a, b, c, d) = (Point(*a), Point(*b), Point(*c), Point(*d))
	x = (b - a).cross(c - b)
	y = (c - b).cross(d - c)
	angle = math.acos(x.dot(y) / (x.absolute() * y.absolute()))
	return '%.2f' % math.degrees(angle)
points = []
for i in range(4):
	point = map(float, input().split())
	points.append(point)
print(calc_angle(*points))


def addcross(b, c, x):
	x[0] = x[0] + b[1] * c[2] - c[1] * b[2]
	x[1] = x[1] - b[0] * c[2] + b[2] * c[0]
	x[2] = x[2] + b[0] * c[1] - c[0] * b[1]
	return x

def subcross(b, c, x):
	x[0] = x[0] - b[1] * c[2] + c[1] * b[2]
	x[1] = x[1] + b[0] * c[2] - b[2] * c[0]
	x[2] = x[2] - b[0] * c[1] + c[0] * b[1]
	return x
z = input()
z = z.split()
a = []
for n in z:
	a.append(float(n))
z = input()
z = z.split()
b = []
for n in z:
	b.append(float(n))
z = input()
z = z.split()
c = []
for n in z:
	c.append(float(n))
z = input()
z = z.split()
d = []
for n in z:
	d.append(float(n))
x = [0, 0, 0]
y = [0, 0, 0]
x = addcross(b, c, x)
x = subcross(a, c, x)
x = addcross(a, b, x)
y = addcross(c, d, y)
y = subcross(b, d, y)
y = addcross(b, c, y)
import math
modx = math.sqrt(pow(x[0], 2) + pow(x[1], 2) + pow(x[2], 2))
mody = math.sqrt(pow(y[0], 2) + pow(y[1], 2) + pow(y[2], 2))
summ = x[0] * y[0] + x[1] * y[1] + x[2] * y[2]
summ = math.acos(summ / (modx * mody))
summ = summ * 180 / 3.14159
print('%.2f' % summ)


import math
a = input().split()
b = input().split()
c = input().split()
d = input().split()
list1 = []
list2 = []
list3 = []
list4 = []
AB = []
BC = []
CD = []
list1 = list(map(float, a))
list2 = list(map(float, b))
list3 = list(map(float, c))
list4 = list(map(float, d))
for i in range(3):
	AB.append(list2[i] - list1[i])
	BC.append(list3[i] - list2[i])
	CD.append(list4[i] - list3[i])
c1 = AB[1] * BC[2] - AB[2] * BC[1]
c2 = AB[2] * BC[0] - AB[0] * BC[2]
c3 = AB[0] * BC[1] - AB[1] * BC[0]
c4 = BC[1] * CD[2] - BC[2] * CD[1]
c5 = BC[2] * CD[0] - BC[0] * CD[2]
c6 = BC[0] * CD[1] - BC[1] * CD[0]
mx = c1 * c1 + c2 * c2 + c3 * c3
mx1 = pow(mx, 0.5)
my = c4 * c4 + c5 * c5 + c6 * c6
my1 = pow(my, 0.5)
mxy = mx1 * my1
dp = c1 * c4 + c2 * c5 + c3 * c6
result = dp / mxy
xxx = math.acos(result)
al = math.degrees(xxx)
print('%.2f' % al)


import math

def cross(valA, valB):
	res = [valA[1] * valB[2] - valA[2] * valB[1], valA[2] * valB[0] - valA[0] * valB[2], valA[0] * valB[1] - valA[1] * valB[0]]
	return res

def dot(valA, valB):
	res = valA[0] * valB[0] + valA[1] * valB[1] + valA[2] * valB[2]
	return res

def mag(valA):
	res = (valA[0] ** 2 + valA[1] ** 2 + valA[2] ** 2) ** 0.5
	return res
pointA = list(map(float, input().split()))
pointB = list(map(float, input().split()))
pointC = list(map(float, input().split()))
pointD = list(map(float, input().split()))
AB = [b - a for (a, b) in zip(pointA, pointB)]
BC = [c - b for (b, c) in zip(pointB, pointC)]
CD = [d - c for (c, d) in zip(pointC, pointD)]
X = cross(AB, BC)
Y = cross(BC, CD)
subangle = dot(X, Y) / (mag(X) * mag(Y))
angle = round(math.acos(subangle) * 180 / math.pi, 2)
print(angle)


import math

class Vect(object):

	def __init__(self, c1, c2, c3):
		self.coords = (c1, c2, c3)

	def minus(self, v2):
		return Vect(*(x - y for (x, y) in zip(self.coords, v2.coords)))

	def plus(self, v2):
		return Vect(*(x + y for (x, y) in zip(self.coords, v2.coords)))

	def d_p(self, v2):
		return sum((x * y for (x, y) in zip(self.coords, v2.coords)))

	def c_p(self, v2):
		c1 = self.coords[1] * v2.coords[2] - self.coords[2] * v2.coords[1]
		c2 = self.coords[2] * v2.coords[0] - self.coords[0] * v2.coords[2]
		c3 = self.coords[0] * v2.coords[1] - self.coords[1] * v2.coords[0]
		return Vect(c1, c2, c3)

	def len(self):
		return math.sqrt(sum([x ** 2 for x in self.coords]))

	def __repr__(self):
		s = ''
		for c in self.coords:
			s += str(c) + ' '
		return s.rstrip(' ')

def main():
	points = []
	for i in range(4):
		points.append(Vect(*(float(x) for x in str(input()).split(' '))))
	(A, B, C, D) = points
	AB = B.minus(A)
	BC = C.minus(B)
	CD = D.minus(C)
	X = AB.c_p(BC)
	Y = BC.c_p(CD)
	cos_val = X.d_p(Y) / (X.len() * Y.len())
	print(round(math.degrees(math.acos(cos_val)), 2))
main()


import math

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def vec(self, p):
		res = (p.x - self.x, p.y - self.y, p.z - self.z)
		return Point(*res)

	def cross(self, p):
		res = (self.y * p.z - p.y * self.z, p.x * self.z - self.x * p.z, self.x * p.y - p.x * self.y)
		return Point(*res)

	def dot(self, p):
		res = self.x * p.x + self.y * p.y + self.z * p.z
		return res

	def mod(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
p1 = list(map(float, input().strip().split()))
p2 = list(map(float, input().strip().split()))
p3 = list(map(float, input().strip().split()))
p4 = list(map(float, input().strip().split()))
a = Point(*p1)
b = Point(*p2)
c = Point(*p3)
d = Point(*p4)
ab = a.vec(b)
bc = b.vec(c)
cd = c.vec(d)
x = ab.cross(bc)
y = bc.cross(cd)
res = math.acos(x.dot(y) / (x.mod() * y.mod()))
res = math.degrees(res)
print('{0:.2f}'.format(res))


from math import acos, sqrt, degrees

class Vertex:

	def __init__(self, coords):
		self.coords = coords

	def __sub__(self, V):
		return Vertex([self.coords[i] - V.coords[i] for i in range(len(self.coords))])

	def abs(self):
		return sqrt(sum([x * x for x in self.coords]))

	def cross(self, V):
		return Vertex([self.coords[1] * V.coords[2] - self.coords[2] * V.coords[1], self.coords[2] * V.coords[0] - self.coords[0] * V.coords[2], self.coords[0] * V.coords[1] - self.coords[1] * V.coords[0]])

	def dot(self, V):
		return sum([self.coords[i] * V.coords[i] for i in range(len(self.coords))])
A = Vertex(list(map(float, input().split())))
B = Vertex(list(map(float, input().split())))
C = Vertex(list(map(float, input().split())))
D = Vertex(list(map(float, input().split())))
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
angle = degrees(acos(X.dot(Y) / X.abs() / Y.abs()))
print('{:.2f}'.format(angle))


from math import sqrt, degrees, acos, sqrt

class Points(object):

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, other):
		x = self.x - other.x
		y = self.y - other.y
		z = self.z - other.z
		return Points(x, y, z)

	def __mul__(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return Points(x, y, z)

	def dot_product(self, other):
		x = self.x * other.x
		y = self.y * other.y
		z = self.z * other.z
		return x + y + z

	def modulus(self):
		return sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

def solve(A, B, C, D):
	(A, B, C, D) = (Points(*A), Points(*B), Points(*C), Points(*D))
	X = (B - A) * (C - B)
	Y = (C - B) * (D - C)
	angle = degrees(acos(X.dot_product(Y) / (X.modulus() * Y.modulus())))
	print('{:.2f}'.format(angle))
points = list()
for i in range(4):
	a = map(float, input().split())
	points.append(a)
solve(*points)


import math

class TorAngle(object):

	def __init__(self, i=0, j=0, k=0):
		self.i = i
		self.j = j
		self.k = k

	def __str__(self):
		return '%.2f,%.2f,%.2f' % (self.i, self.j, self.k)

	def vector(self, other):
		vec = TorAngle()
		vec.i = other.i - self.i
		vec.j = other.j - self.j
		vec.k = other.k - self.k
		return vec

	def dot(self, other):
		dotp = self.i * other.i + self.j * other.j + self.k * other.k
		return dotp

	def cross(self, other):
		crossp = TorAngle()
		crossp.i = self.j * other.k - self.k * other.j
		crossp.j = -(self.i * other.k - self.k * other.i)
		crossp.k = self.i * other.j - self.j * other.i
		return crossp

	def modulus(self):
		mod = (self.i ** 2 + self.j ** 2 + self.k ** 2) ** 0.5
		return mod

	def plane(self, other, other1, other2):
		X = TorAngle()
		Y = TorAngle()
		temp1 = self.vector(other)
		temp2 = other.vector(other1)
		temp3 = other1.vector(other2)
		temp4 = temp1.cross(temp2)
		temp5 = temp2.cross(temp3)
		(X.i, X.j, X.k) = (temp4.i, temp4.j, temp4.k)
		(Y.i, Y.j, Y.k) = (temp5.i, temp5.j, temp5.k)
		X.angle(Y)

	def angle(self, other):
		temp = math.acos(self.dot(other) / (self.modulus() * other.modulus()))
		phi = temp * (180.0 / math.pi)
		print('%.2f' % phi)
lst = list()
for i in range(4):
	temp = input()
	lst.append(temp.split(' '))
A = [float(lst[0][0]), float(lst[0][1]), float(lst[0][2])]
B = [float(lst[1][0]), float(lst[1][1]), float(lst[1][2])]
C = [float(lst[2][0]), float(lst[2][1]), float(lst[2][2])]
D = [float(lst[3][0]), float(lst[3][1]), float(lst[3][2])]
p1 = TorAngle(A[0], A[1], A[2])
p2 = TorAngle(B[0], B[1], B[2])
p3 = TorAngle(C[0], C[1], C[2])
p4 = TorAngle(D[0], D[1], D[2])
TorAngle.plane(p1, p2, p3, p4)


from math import acos, degrees
a = [float(i) for i in input().split()]
b = [float(i) for i in input().split()]
c = [float(i) for i in input().split()]
d = [float(i) for i in input().split()]
ab = [b[0] - a[0], b[1] - a[1], b[2] - a[2]]
bc = [c[0] - b[0], c[1] - b[1], c[2] - b[2]]
cd = [d[0] - c[0], d[1] - c[1], d[2] - c[2]]
x = [ab[1] * bc[2] - bc[1] * ab[2], ab[2] * bc[0] - ab[0] * bc[2], ab[0] * bc[1] - bc[0] * ab[1]]
y = [bc[1] * cd[2] - cd[1] * bc[2], bc[2] * cd[0] - bc[0] * cd[2], bc[0] * cd[1] - cd[0] * bc[1]]
xy = x[0] * y[0] + x[1] * y[1] + x[2] * y[2]
mod_x = pow(x[0] ** 2 + x[1] ** 2 + x[2] ** 2, 0.5)
mod_y = pow(y[0] ** 2 + y[1] ** 2 + y[2] ** 2, 0.5)
cos_phi = xy / (mod_x * mod_y)
phi = acos(cos_phi)
print(round(degrees(phi), 2))


import math
A = list(map(float, input().split(' ')))
B = list(map(float, input().split(' ')))
C = list(map(float, input().split(' ')))
D = list(map(float, input().split(' ')))

def dotProduct(x, y):
	return x[0] * y[0] + x[1] * y[1] + x[2] * y[2]

def absolut(x):
	return math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2])

def lineSegment(x, y):
	return [x[0] - y[0], x[1] - y[1], x[2] - y[2]]

def crossProduct(x, y):
	return [x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0]]
X = crossProduct(lineSegment(A, B), lineSegment(B, C))
Y = crossProduct(lineSegment(B, C), lineSegment(C, D))
up = dotProduct(X, Y)
down = absolut(X) * absolut(Y)
val = up / down
erg = math.acos(val) * 180 / math.pi
print('{0:.2f}'.format(erg))


import math
(Ax, Ay, Az) = input().split()
(Bx, By, Bz) = input().split()
(Cx, Cy, Cz) = input().split()
(Dx, Dy, Dz) = input().split()
(ABx, ABy, ABz) = (float(Bx) - float(Ax), float(By) - float(Ay), float(Bz) - float(Az))
(BCx, BCy, BCz) = (float(Cx) - float(Bx), float(Cy) - float(By), float(Cz) - float(Bz))
(CDx, CDy, CDz) = (float(Dx) - float(Cx), float(Dy) - float(Cy), float(Dz) - float(Cz))
(Xx, Xy, Xz) = (ABy * BCz - ABz * BCy, ABz * BCx - ABx * BCz, ABx * BCy - ABy * BCx)
(Yx, Yy, Yz) = (BCy * CDz - BCz * CDy, BCz * CDx - BCx * CDz, BCx * CDy - BCy * CDx)
DotProduct = Xx * Yx + Xy * Yy + Xz * Yz
Modx = math.sqrt(Xx * Xx + Xy * Xy + Xz * Xz)
Mody = math.sqrt(Yx * Yx + Yy * Yy + Yz * Yz)
angle = DotProduct / (Modx * Mody)
rad = math.acos(angle)
degree = math.degrees(rad)
print('{:.2f}'.format(degree))


import math

class Point(object):

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, other):
		x = self.x - other.x
		y = self.y - other.y
		z = self.z - other.z
		return Point(x, y, z)

	def cross_product(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return Point(x, y, z)

	def dot_product(self, other):
		x = self.x * other.x
		y = self.y * other.y
		z = self.z * other.z
		return x + y + z

	def magnitude(self):
		(x, y, z) = (self.x, self.y, self.z)
		return math.sqrt(x * x + y * y + z * z)

	def __str__(self):
		return str((self.x, self.y, self.z))

	def __repr__(self):
		return repr((self.x, self.y, self.z))

def torsional_angle(a, b, c, d):
	(ab, bc, cd) = (a - b, b - c, c - d)
	x = ab.cross_product(bc)
	y = bc.cross_product(cd)
	num = x.dot_product(y)
	denom = x.magnitude() * y.magnitude()
	cos_phi = num / denom
	angle = math.degrees(math.acos(cos_phi))
	return angle

def read_point():
	(x, y, z) = (float(p) for p in input().strip().split())
	return Point(x, y, z)

def main():
	(a, b, c, d) = (read_point() for _ in range(4))
	phi = torsional_angle(a, b, c, d)
	print('%.2f' % phi)
main()


import math

def vector(a, b):
	return [x[1] - x[0] for x in zip(a, b)]

def outProduct(a, b):
	return [a[1] * b[2] - a[2] * b[1], b[0] * a[2] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]

def innerProduct(a, b):
	return sum([x[0] * x[1] for x in zip(a, b)])
pts = []
for i in range(4):
	pts.append(list(map(float, input().split())))
x = outProduct(vector(pts[0], pts[1]), vector(pts[1], pts[2]))
y = outProduct(vector(pts[1], pts[2]), vector(pts[2], pts[3]))
phi = math.acos(innerProduct(x, y) / math.sqrt(innerProduct(x, x) * innerProduct(y, y)))
print('%.2f' % (phi * 180 / math.pi))


import math

class vec3:
	v = []

	def __init__(self, vec):
		self.v = vec

	def mag(self):
		sum = 0
		for i in range(0, len(self.v)):
			sum += self.v[i] ** 2
		return math.sqrt(sum)

	def dot(self, vec):
		sum = 0
		for i in range(0, len(self.v)):
			sum += self.v[i] * vec.v[i]
		return sum

	def cross(self, vec):
		o = []
		o.append(self.v[1] * vec.v[2] - self.v[2] * vec.v[1])
		o.append(self.v[2] * vec.v[0] - self.v[0] * vec.v[2])
		o.append(self.v[0] * vec.v[1] - self.v[1] * vec.v[0])
		return vec3(o)

	def __add__(self, other):
		x = []
		for i in range(0, len(self.v)):
			x.append(self.v[i] + other.v[i])
		return vec3(x)

	def __sub__(self, other):
		x = []
		for i in range(0, len(self.v)):
			x.append(self.v[i] - other.v[i])
		return vec3(x)

def radToDeg(angle):
	return angle * 180.0 / math.acos(-1.0)
a = vec3([float(x) for x in input().split()])
b = vec3([float(x) for x in input().split()])
c = vec3([float(x) for x in input().split()])
d = vec3([float(x) for x in input().split()])
AlphaPlane = (a - b).cross(c - b)
BetaPlane = (b - c).cross(d - c)
phi = math.acos(AlphaPlane.dot(BetaPlane) / (AlphaPlane.mag() * BetaPlane.mag()))
phi = radToDeg(phi)
print('%.2f' % phi)


import math

class point:

	def __init__(self, x=0, y=0, z=0):
		self.x = x
		self.y = y
		self.z = z

	def to(self, other):
		x = other.x - self.x
		y = other.y - self.y
		z = other.z - self.z
		return line(x, y, z)

class line:

	def __init__(self, x=0, y=0, z=0):
		self.x = x
		self.y = y
		self.z = z

	def cross_product(self, other):
		x = self.y * other.z - self.z * other.y
		y = self.z * other.x - self.x * other.z
		z = self.x * other.y - self.y * other.x
		return line(x, y, z)

	def dot_product(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def mod(self):
		return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z)
(x, y, z) = map(float, input().split())
a = point(x, y, z)
(x, y, z) = map(float, input().split())
b = point(x, y, z)
(x, y, z) = map(float, input().split())
c = point(x, y, z)
(x, y, z) = map(float, input().split())
d = point(x, y, z)
x = a.to(b).cross_product(b.to(c))
y = b.to(c).cross_product(c.to(d))
phi = x.dot_product(y) / x.mod() / y.mod()
print('%.2f' % (math.acos(phi) / 3.1415926 * 180))


import math

class Point3f:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __sub__(self, p):
		return Point3f(self.x - p.x, self.y - p.y, self.z - p.z)

	def cross(self, p):
		x = self.y * p.z - self.z * p.y
		y = self.z * p.x - self.x * p.z
		z = self.x * p.y - self.y * p.x
		return Point3f(x, y, z)

	def dot(self, p):
		return self.x * p.x + self.y * p.y + self.z * p.z

	def norm(self):
		return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z)

def getPoint():
	inp = input().split()
	inp = list(map(float, inp))
	return Point3f(inp[0], inp[1], inp[2])
A = getPoint()
B = getPoint()
C = getPoint()
D = getPoint()
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
cosPhi = X.dot(Y) / (X.norm() * Y.norm())
print('%.2f' % math.degrees(math.acos(cosPhi)))


import math

def assignListSize(lList, nSize):
	for i in range(nSize):
		lList.append(0)

class MatrixCompute:

	def crossProduct(self, matrixA, matrixB):
		matrixC = list()
		assignListSize(matrixC, len(matrixA))
		matrixC[0] = matrixA[1] * matrixB[2] - matrixA[2] * matrixB[1]
		matrixC[1] = matrixA[2] * matrixB[0] - matrixA[0] * matrixB[2]
		matrixC[2] = matrixA[0] * matrixB[1] - matrixA[1] * matrixB[0]
		return matrixC

	def dotProduct(self, matrixA, matrixB):
		if len(matrixA) != len(matrixB):
			print('Matrix size not same in dot product')
		sumDP = 0.0
		for i in range(len(matrixA)):
			sumDP += matrixA[i] * matrixB[i]
		return sumDP

	def getVector(self, matrixA, matrixB):
		matrixC = list()
		assignListSize(matrixC, len(matrixA))
		for i in range(len(matrixA)):
			matrixC[i] = matrixB[i] - matrixA[i]
		return matrixC

	def getLen(self, matrixA):
		vectorLen = 0.0
		for i in range(len(matrixA)):
			vectorLen += math.pow(matrixA[i], 2)
		vectorLen = math.sqrt(vectorLen)
		return vectorLen

	def divide(self, matrixA, nValue):
		matrixC = list()
		assignListSize(matrixC, len(matrixA))
		for i in range(len(matrixA)):
			matrixB = matrixA[i] / nValue
		return matrixB

class LineCompute:

	def getCrossProduct(self, lPoints):
		if len(lPoints) != 4:
			print('Points not 4. something wrong')
		mt = MatrixCompute()
		matrixAB = mt.getVector(lPoints[0], lPoints[1])
		matrixBC = mt.getVector(lPoints[1], lPoints[2])
		matrixCD = mt.getVector(lPoints[2], lPoints[3])
		matrixX = mt.crossProduct(matrixAB, matrixBC)
		matrixY = mt.crossProduct(matrixBC, matrixCD)
		cosTheta = mt.dotProduct(matrixX, matrixY) / (mt.getLen(matrixX) * mt.getLen(matrixY))
		n = math.acos(cosTheta) * 180 / math.pi
		print('%.2f' % n)
lPoints = list()
for i in range(4):
	lPoints.append(list(map(float, input().split())))
m = LineCompute()
m.getCrossProduct(lPoints)


import math

def dot(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

def line(x, y):
	return [y[i] - x[i] for i in range(len(x))]

def cross(x, y):
	return [x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0]]

def mag(x):
	return math.sqrt(x[0] ** 2 + x[1] ** 2 + x[2] ** 2)
a = list(map(float, input().split(' ')))
b = list(map(float, input().split(' ')))
c = list(map(float, input().split(' ')))
d = list(map(float, input().split(' ')))
ab = line(a, b)
bc = line(b, c)
cd = line(c, d)
x = cross(ab, bc)
y = cross(bc, cd)
val = dot(x, y) / (mag(x) * mag(y))
ang = math.degrees(math.acos(val))
print('%.2lf' % ang)


import math

class pt:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def set(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def dot(self, p):
		return self.x * p.x + self.y * p.y + self.z * p.z

	def cross(self, p):
		return pt(self.y * p.z - p.y * self.z, p.x * self.z - self.x * p.z, self.x * p.y - p.x * self.y)

	def vect(self, p):
		return pt(p.x - self.x, p.y - self.y, p.z - self.z)

	def mod(self):
		return pow(self.x * self.x + self.y * self.y + self.z * self.z, 1 / 2)
(x, y, z) = input().strip().split(' ')
A = pt(float(x), float(y), float(z))
(x, y, z) = input().strip().split(' ')
B = pt(float(x), float(y), float(z))
(x, y, z) = input().strip().split(' ')
C = pt(float(x), float(y), float(z))
(x, y, z) = input().strip().split(' ')
D = pt(float(x), float(y), float(z))
AB = A.vect(B)
BC = B.vect(C)
CD = C.vect(D)
X = AB.cross(BC)
Y = BC.cross(CD)
cosP = X.dot(Y) / (X.mod() * Y.mod())
phi = math.acos(cosP) * 180 / math.pi
print('%0.2f' % phi)


import sys
import itertools
import math

def readIn(lineData):
	return list(map(float, lineData))

def phi(x, y):
	return math.acos(dotp(x, y) / (norm(x) * norm(y))) * (360.0 / (2.0 * math.pi))

def subti(ai, bi):
	return ai - bi

def multi(ai, bi):
	return ai * bi

def zw(f, a, b):
	return [f(a[i], b[i]) for i in range(min(len(a), len(b)))]

def subt(a, b):
	return zw(subti, a, b)

def dotp(a, b):
	return sum(zw(multi, a, b))

def norm(a):
	return math.sqrt(dotp(a, a))

def cross(a, b):
	(ax, ay, az) = a
	(bx, by, bz) = b
	return (ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx)
(a, b, c, d) = [readIn(l.strip().split(' ')) for l in sys.stdin]
ab = subt(a, b)
bc = subt(b, c)
cd = subt(c, d)
x = cross(ab, bc)
y = cross(bc, cd)
print('{0:.2f}'.format(phi(x, y)))


import math

class Point:

	def __init__(self, x, y, z):
		(self.x, self.y, self.z) = (x, y, z)

	def mag(self):
		return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5

	def __sub__(self, p):
		return Point(self.x - p.x, self.y - p.y, self.z - p.z)

	def cross(self, p):
		return Point(self.y * p.z - self.z * p.y, self.z * p.x - self.x * p.z, self.x * p.y - self.y * p.x)

	def dot(self, p):
		return self.x * p.x + self.y * p.y + self.z * p.z
(A, B, C, D) = [Point(*list(map(float, input().split()))) for i in range(4)]
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
print('%.2f' % (math.acos(X.dot(Y) / (X.mag() * Y.mag())) * (180 / math.pi)))


import math

class Point:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

class LineSegment:

	def __init__(self, point1, point2):
		self.point1 = point1
		self.point2 = point2

	@property
	def x(self):
		return self.point2.x - self.point1.x

	@property
	def y(self):
		return self.point2.y - self.point1.y

	@property
	def z(self):
		return self.point2.z - self.point1.z

	@property
	def magnitude(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

	def dot_product(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def cross_product(self, other):
		return LineSegment(point1=Point(x=0, y=0, z=0), point2=Point(x=self.y * other.z - self.z * other.y, y=self.z * other.x - self.x * other.z, z=self.x * other.y - self.y * other.x))
a = Point(*map(float, input().split()))
b = Point(*map(float, input().split()))
c = Point(*map(float, input().split()))
d = Point(*map(float, input().split()))
ab = LineSegment(point1=a, point2=b)
bc = LineSegment(point1=b, point2=c)
cd = LineSegment(point1=c, point2=d)
x = ab.cross_product(bc)
y = bc.cross_product(cd)
angle = math.degrees(math.acos(x.dot_product(y) / (x.magnitude * y.magnitude)))
print('{:.2f}'.format(angle))


import math

def cross_product(a, b):
	return (a[1] * b[2] - b[1] * a[2], b[0] * a[2] - a[0] * b[2], a[0] * b[1] - b[0] * a[1])

def minus(a, b):
	return (a[0] - b[0], a[1] - b[1], a[2] - b[2])

def dot_product(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
a = tuple(map(float, input().split()))
b = tuple(map(float, input().split()))
c = tuple(map(float, input().split()))
d = tuple(map(float, input().split()))
a_b = minus(a, b)
b_c = minus(b, c)
c_d = minus(c, d)
x = cross_product(a_b, b_c)
y = cross_product(b_c, c_d)
cos_phi = dot_product(x, y) / math.sqrt(dot_product(x, x) * dot_product(y, y))
print('%.2f' % (math.acos(cos_phi) / math.pi * 180))


import math

def line(p1, p2):
	vec = list()
	for i in range(3):
		vec.append(p1[i] - p2[i])
	return vec

def dot_product(l1, l2):
	result = 0
	for i in range(3):
		result += l1[i] * l2[i]
	return result

def cross_product(l1, l2):
	vec = list()
	vec.append(l1[1] * l2[2] - l1[2] * l2[1])
	vec.append(l1[2] * l2[0] - l1[0] * l2[2])
	vec.append(l1[0] * l2[1] - l1[1] * l2[0])
	return vec

def length(vec):
	result = 0
	for i in range(3):
		result += vec[i] * vec[i]
	return math.sqrt(result)
A = list(map(float, input().split()))
B = list(map(float, input().split()))
C = list(map(float, input().split()))
D = list(map(float, input().split()))
AB = line(A, B)
BC = line(B, C)
CD = line(C, D)
X = cross_product(AB, BC)
Y = cross_product(BC, CD)
cosPhi = dot_product(X, Y) / (length(X) * length(Y))
Phi = math.acos(cosPhi) / math.pi * 180
print('%.2f' % Phi)


import math

def cross(a, b):
	return (a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0])

def dot(a, b):
	return sum((ai * bi for (ai, bi) in zip(a, b)))
a = map(float, input().split())
b = tuple(map(float, input().split()))
c = tuple(map(float, input().split()))
d = map(float, input().split())
ab = [bi - ai for (bi, ai) in zip(b, a)]
bc = [ci - bi for (ci, bi) in zip(c, b)]
cd = [di - ci for (di, ci) in zip(d, c)]
x = cross(ab, bc)
y = cross(bc, cd)
nx = math.sqrt(dot(x, x))
ny = math.sqrt(dot(y, y))
cphi = dot(x, y) / (nx * ny)
phi = math.acos(cphi)
print('%.2f' % math.degrees(phi))


from math import *
points = []

def cross(a, b):
	return [a[1] * b[2] - b[1] * a[2], a[2] * b[0] - b[2] * a[0], a[0] * b[1] - b[0] * a[1]]

def dot(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

def length(a):
	return sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2])

def minus(a, b):
	return [a[0] - b[0], a[1] - b[1], a[2] - b[2]]
for i in range(4):
	points.append(list(map(float, input().split())))
X = cross(minus(points[0], points[1]), minus(points[1], points[2]))
Y = cross(minus(points[1], points[2]), minus(points[2], points[3]))
cosphi = dot(X, Y) / (length(X) * length(Y))
print('%.2f' % degrees(acos(cosphi)))


import math

class Point3D:

	def __init__(self, x, y, z):
		self.X = x
		self.Y = y
		self.Z = z

	def toString(self):
		return '[' + str(self.X) + ', ' + str(self.Y) + ', ' + str(self.Z) + ']'

	def findTorsionalAngle(A, B, C, D):
		u1 = A.X - B.X
		v1 = B.X - C.X
		w1 = C.X - D.X
		u2 = A.Y - B.Y
		v2 = B.Y - C.Y
		w2 = C.Y - D.Y
		u3 = A.Z - B.Z
		v3 = B.Z - C.Z
		w3 = C.Z - D.Z
		AB = [u1, u2, u3]
		BC = [v1, v2, v3]
		CD = [w1, w2, w3]
		ABxBC = [u2 * v3 - u3 * v2, u3 * v1 - u1 * v3, u1 * v2 - u2 * v1]
		ABxBC_abs = math.sqrt(ABxBC[0] * ABxBC[0] + ABxBC[1] * ABxBC[1] + ABxBC[2] * ABxBC[2])
		BCxCD = [v2 * w3 - v3 * w2, v3 * w1 - v1 * w3, v1 * w2 - v2 * w1]
		BCxCD_abs = math.sqrt(BCxCD[0] * BCxCD[0] + BCxCD[1] * BCxCD[1] + BCxCD[2] * BCxCD[2])
		ABxBC_dot_BCxCD = ABxBC[0] * BCxCD[0] + ABxBC[1] * BCxCD[1] + ABxBC[2] * BCxCD[2]
		torsional_angle = ABxBC_dot_BCxCD / (ABxBC_abs * BCxCD_abs)
		return math.acos(torsional_angle)
a_to_f = lambda x: float(x)
A_raw = str(input()).split(' ')
A_as_ints = list(map(a_to_f, A_raw))
A = Point3D(A_as_ints[0], A_as_ints[1], A_as_ints[2])
B_raw = str(input()).split(' ')
B_as_ints = list(map(a_to_f, B_raw))
B = Point3D(B_as_ints[0], B_as_ints[1], B_as_ints[2])
C_raw = str(input()).split(' ')
C_as_ints = list(map(a_to_f, C_raw))
C = Point3D(C_as_ints[0], C_as_ints[1], C_as_ints[2])
D_raw = str(input()).split(' ')
D_as_ints = list(map(a_to_f, D_raw))
D = Point3D(D_as_ints[0], D_as_ints[1], D_as_ints[2])
torsional_angle = Point3D.findTorsionalAngle(A, B, C, D)
torsional_angle_in_deg = torsional_angle * 180 / math.pi
print('%.2f' % torsional_angle_in_deg)


import math

def cross(a, b):
	return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]

def dot(a, b):
	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

def norm(a):
	return (a[0] ** 2 + a[1] ** 2 + a[2] ** 2) ** 0.5

def normalize(a):
	n = norm(a)
	return [i / n for i in a]
A = [float(x) for x in input().split()]
B = [float(x) for x in input().split()]
C = [float(x) for x in input().split()]
D = [float(x) for x in input().split()]
AB = [x - y for (x, y) in zip(B, A)]
BC = [x - y for (x, y) in zip(C, B)]
CD = [x - y for (x, y) in zip(D, C)]
X = cross(AB, BC)
Y = cross(BC, CD)
dotp = dot(X, Y)
modX = norm(X)
modY = norm(Y)
print('%.2f' % math.degrees(math.acos(dotp / (modX * modY))))


import math

def minus(x, y):
	return [y[i] - x[i] for i in range(3)]

def multiply(x, y):
	res = [0, 0, 0]
	res[0] = x[1] * y[2] - x[2] * y[1]
	res[1] = -(x[0] * y[2] - x[2] * y[0])
	res[2] = x[0] * y[1] - x[1] * y[0]
	return res

def dot(x, y):
	return x[0] * y[0] + x[1] * y[1] + x[2] * y[2]

def mod(x):
	return math.sqrt(dot(x, x))
A = [float(e) for e in input().split()]
B = [float(e) for e in input().split()]
C = [float(e) for e in input().split()]
D = [float(e) for e in input().split()]
AB = minus(A, B)
BC = minus(B, C)
CD = minus(C, D)
ABC = multiply(AB, BC)
BCD = multiply(BC, CD)
res = math.acos(dot(ABC, BCD) / mod(ABC) / mod(BCD)) * 180 / math.pi
print('{0:.2f}'.format(res))


from math import sqrt, acos, degrees

class Vector:

	def __init__(self, x, y, z):
		self.x = x
		self.y = y
		self.z = z

	def __repr__(self):
		return '({self.x}, {self.y}, {self.z})'.format(self)

	def dot(self, w):
		return self.x * w.x + self.y * w.y + self.z * w.z

	def mod(self):
		return sqrt(self.dot(self))

	def cross(self, w):
		return Vector(self.y * w.z - self.z * w.y, self.z * w.x - self.x * w.z, self.x * w.y - self.y * w.x)
lis = []
for i in range(4):
	lis.append(input().split())
A = [float(i) for i in lis[0]]
B = [float(i) for i in lis[1]]
C = [float(i) for i in lis[2]]
D = [float(i) for i in lis[3]]
AB = Vector(A[0] - B[0], A[1] - B[1], A[2] - B[2])
BC = Vector(B[0] - C[0], B[1] - C[1], B[2] - C[2])
CD = Vector(C[0] - D[0], C[1] - D[1], C[2] - D[2])
X = AB.cross(BC)
Y = BC.cross(CD)
PHI = degrees(acos(X.dot(Y) / (X.mod() * Y.mod())))
print('{0:0.2f}'.format(PHI))


import math
import operator
__author__ = 'mison6'

class TorsionalAngle:

	def __init__(self, pts):
		self._pts = [[float(n) for n in pt] for pt in pts]
		self.a = self._pts[0]
		self.b = self._pts[1]
		self.c = self._pts[2]
		self.d = self._pts[3]

	def get_angle(self):
		x = self.cross(self.vector(self.a, self.b), self.vector(self.b, self.c))
		y = self.cross(self.vector(self.b, self.c), self.vector(self.c, self.d))
		return math.acos(self.dot(x, y) / (self.mag(x) * self.mag(y))) * 180 / math.pi

	@staticmethod
	def cross(a, b):
		return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]

	@staticmethod
	def dot(a, b):
		return sum(map(operator.mul, a, b))

	@staticmethod
	def vector(a, b):
		return list(map(operator.sub, a, b))

	@staticmethod
	def mag(a):
		return math.sqrt(sum([ai * ai for ai in a]))
pts = [input().split() for _ in range(4)]
ta = TorsionalAngle(pts)
print('%.2f' % ta.get_angle())


a = list(map(float, input().split(' ')))
b = list(map(float, input().split(' ')))
c = list(map(float, input().split(' ')))
d = list(map(float, input().split(' ')))
import math

def line(x, y):
	z = []
	for i in range(len(x)):
		z.append(y[i] - x[i])
	return z

def cross(x, y):
	return [x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0]]

def dot(x, y):
	return x[0] * y[0] + x[1] * y[1] + x[2] * y[2]

def mag(x):
	return math.sqrt(x[0] ** 2 + x[1] ** 2 + x[2] ** 2)
ab = line(a, b)
bc = line(b, c)
cd = line(c, d)
x = cross(ab, bc)
y = cross(bc, cd)
c = dot(x, y) / (mag(x) * mag(y))
ang = math.degrees(math.acos(c))
print('%0.2f' % ang)


import math

def makeArrayToFloat(arr):
	newArr = []
	for num in arr:
		newArr.append(float(num))
	return newArr

def makeVector(a, b):
	return [b[0] - a[0], b[1] - a[1], b[2] - a[2]]

def vectorMultiplication(vec1, vec2):
	return [vec1[1] * vec2[2] - vec1[2] * vec2[1], vec1[2] * vec2[0] - vec1[0] * vec2[2], vec1[0] * vec2[1] - vec1[1] * vec2[0]]

def scalarMultiplication(vec1, vec2):
	return vec1[0] * vec2[0] + vec1[1] * vec2[1] + vec1[2] * vec2[2]

def getVectorLength(vec):
	return math.sqrt(math.pow(vec[0], 2) + math.pow(vec[1], 2) + math.pow(vec[2], 2))
(a, b, c, d) = (input().split(), input().split(), input().split(), input().split())
a = makeArrayToFloat(a)
b = makeArrayToFloat(b)
c = makeArrayToFloat(c)
d = makeArrayToFloat(d)
AB = makeVector(a, b)
BC = makeVector(b, c)
CD = makeVector(c, d)
X = vectorMultiplication(AB, BC)
Y = vectorMultiplication(BC, CD)
answer = math.degrees(math.acos(scalarMultiplication(X, Y) / (getVectorLength(X) * getVectorLength(Y))))
print('{0:.2f}'.format(round(answer, 2)))


import math
coord = []
for i in range(4):
	coord.append([float(number) for number in input().split()])
ab = [b - a for (a, b) in zip(coord[0], coord[1])]
bc = [c - b for (c, b) in zip(coord[2], coord[1])]
cd = [d - c for (d, c) in zip(coord[3], coord[2])]
n1 = [ab[1] * bc[2] - ab[2] * bc[1], ab[2] * bc[0] - ab[0] * bc[2], ab[0] * bc[1] - ab[1] * bc[0]]
n2 = [bc[1] * cd[2] - bc[2] * cd[1], bc[2] * cd[0] - bc[0] * cd[2], bc[0] * cd[1] - bc[1] * cd[0]]
top = 0
bottom1 = 0
bottom2 = 0
for i in range(3):
	top += n1[i] * n2[i]
	bottom1 += n1[i] ** 2
	bottom2 += n2[i] ** 2
result = math.degrees(math.acos(top / (math.sqrt(bottom1) * math.sqrt(bottom2))))
print('{:.2f}'.format(result))


import math

class Point:

	def __init__(self, x, y, z):
		self.x = float(x)
		self.y = float(y)
		self.z = float(z)
		self.point = (self.x, self.y, self.z)

	def __add__(self, other):
		x = self.x + other.x
		y = self.y + other.y
		z = self.z + other.z
		return Point(x, y, z)

	def __sub__(self, other):
		x = self.x - other.x
		y = self.y - other.y
		z = self.z - other.z
		return Point(x, y, z)

	def __iter__(self):
		return iter(self.point)

	def __str__(self):
		return str(self.point)

	def cross(self, other):
		return Point(*tuple((self.y * other.z - self.z * other.y, -self.x * other.z + self.z * other.x, self.x * other.y - self.y * other.x)))

	def norm(self):
		return float(self.x * self.x + self.y * self.y + self.z * self.z) ** 0.5

	def dot(self, other):
		return self.x * other.x + self.y * other.y + self.z * other.z

	def __str__(self):
		return str(self.Point)
A = Point(*tuple((float(i) for i in input().split())))
B = Point(*tuple((float(i) for i in input().split())))
C = Point(*tuple((float(i) for i in input().split())))
D = Point(*tuple((float(i) for i in input().split())))
AB = B - A
BC = C - B
CD = D - C
X = AB.cross(BC)
Y = BC.cross(CD)
XY = X.dot(Y)
costheta = XY / (X.norm() * Y.norm())

def calc_theta(costheta):
	to_deg = 360 / (2 * 3.14159)
	return math.acos(costheta) * to_deg
print('{:.2f}'.format(calc_theta(costheta)))


import math

class Vector:

	def __init__(self, v):
		(self.x, self.y, self.z) = (v[0], v[1], v[2])

	def sub(self, v):
		return Vector([self.x - v.x, self.y - v.y, self.z - v.z])

	def dot(self, v):
		return self.x * v.x + self.y * v.y + self.z * v.z

	def crs(self, v):
		u = self
		return Vector([u.y * v.z - u.z * v.y, u.z * v.x - u.x * v.z, u.x * v.y - u.y * v.x])

	def mag(self):
		return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
A = Vector([float(i) for i in input().split()])
B = Vector([float(i) for i in input().split()])
C = Vector([float(i) for i in input().split()])
D = Vector([float(i) for i in input().split()])
AB = B.sub(A)
BC = C.sub(B)
CD = D.sub(C)
X = AB.crs(BC)
Y = BC.crs(CD)
Z = X.dot(Y) / (X.mag() * Y.mag())
PHI = math.acos(Z) * 180 / math.pi
print('%.2f' % PHI)


from math import acos, degrees, sqrt

class Vector:

	def __init__(self, a, b, c):
		self.a = a
		self.b = b
		self.c = c

	def __str__(self):
		return '({:.2f} {:.2f} {:.2f})'.format(self.a, self.b, self.c)

	def __abs__(self):
		return sqrt(self.a ** 2 + self.b ** 2 + self.c ** 2)

	def __sub__(self, other):
		a = self.a - other.a
		b = self.b - other.b
		c = self.c - other.c
		return Vector(a, b, c)

	def __mul__(self, other):
		a = self.b * other.c - self.c * other.b
		b = self.c * other.a - self.a * other.c
		c = self.a * other.b - self.b * other.a
		return Vector(a, b, c)

	def dot_product(self, other):
		a = self.a * other.a
		b = self.b * other.b
		c = self.c * other.c
		return a + b + c

def solve(a, b, c, d):
	x = (b - a) * (c - b)
	y = (c - b) * (d - c)
	phi = degrees(acos(x.dot_product(y) / (abs(x) * abs(y))))
	return float('{:.2f}'.format(phi))
vectors = [Vector(*list(map(float, input().split()))) for _ in range(4)]
print(solve(*vectors))