# Story

You were supposed to implement a node-based calculator. Hopefully for you, a colleague agreed to do the task. When the management saw the code, they were infuriated with its low quality, and as a punishment told you to shorten it as much as possible...

___

# Task

You will be given a ready solution passing all the fixed and random tests. Unfortunately for you, it is very long and overly repetitive. Current code length is `901` characters. Your task is to shorten it to at most `300` characters.

**Note/hint**: you can modify the implementation any way you want, as long as it is written using only OOP; the sample tests check solution's functionality the same way as the final tests do - if your solution passes the former, it will also pass the latter.

Source: codewars | Difficulty: EASY

Starter code: def __init__(s,a,b):
	

Solutions:
import operator as o

class v:

	def __init__(s, a, b):
		(s.a, s.b) = (a, b)

	def compute(s):
		return getattr(o, type(s).__name__)(s.a, s.b)

class value(int):
	pass

class add(v):
	pass

class sub(v):
	pass

class mul(v):
	pass

class truediv(v):
	pass

class mod(v):
	pass

class pow(v):
	pass


import operator as op

class N:

	def __init__(s, *v):
		s.v = v

	def compute(s):
		return getattr(op, s.__class__.__name__)(s.v[0].c(), s.v[1].c())

class add(N):
	pass

class sub(N):
	pass

class mul(N):
	pass

class truediv(N):
	pass

class mod(N):
	pass

class pow(N):
	pass

class value(N):

	def c(s):
		return s.v[0]


class value:

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

class o:

	def __init__(self, a, b):
		(A, B) = (a.v, b.v)
		self.r = {add: A + B, sub: A - B, mul: A * B, truediv: A / B, mod: A % B, pow: A ** B}[type(self)]

	def compute(self):
		return self.r

class add(o):
	1

class sub(o):
	1

class mul(o):
	1

class truediv(o):
	1

class mod(o):
	1

class pow(o):
	1


def i(s, x, y=0):
	s.x = getattr(x.x, s._)(y.x) if y else x

class v:
	(__init__, compute) = (i, lambda s: s.x)
for p in dir(0):
	value = vars()[p[2:-2]] = type(p, (v,), {'_': p})


class value:

	def __init__(s, a, b=0):
		s.v = a
		if b != 0:
			s.v = {add: a.v + b.v, sub: a.v - b.v, mul: a.v * b.v, truediv: a.v / b.v, mod: a.v % b.v, pow: a.v ** b.v}[type(s)]

class v(value):

	def compute(s):
		return s.v

class add(v):
	1

class sub(v):
	1

class mul(v):
	1

class truediv(v):
	1

class mod(v):
	1

class pow(v):
	1


class value:

	def __init__(s, x, y=0):
		s.x = getattr(x.x, s._)(y.x) if y else x

	def compute(s):
		return s.x
locals().update({p[2:-2]: type(p, (value,), {'_': p}) for p in dir(int) if '_' == p[-2]})


def M(H):

	class R:
		(__init__, compute) = (lambda O, Q, S=[]: setattr(O, 'O', Q if [] == S else getattr(int, f'__{H}__')(Q.O, S.O)), lambda O: O.O)
	return R
(value, add, sub, mul, truediv, mod, pow) = map(M, '* add sub mul truediv mod pow'.split())


class F:

	def __init__(S, *a):
		S.a = a
	compute = lambda S: __import__('operator').__dict__[type(S).__name__](*(x.compute() for x in S.a))

class value(F):
	compute = lambda S: S.a[0]

class add(F):
	pass

class sub(F):
	pass

class mul(F):
	pass

class truediv(F):
	pass

class mod(F):
	pass

class pow(F):
	pass


class N:

	def __init__(s, a, b):
		(s.a, s.b) = (a, b)

class value(int):
	1

class add(N):
	compute = lambda s: s.a + s.b

class sub(N):
	compute = lambda s: s.a - s.b

class mul(N):
	compute = lambda s: s.a * s.b

class truediv(N):
	compute = lambda s: s.a / s.b

class mod(N):
	compute = lambda s: s.a % s.b

class pow(N):
	compute = lambda s: s.a ** s.b


from operator import add, sub, mul, pow, truediv, mod

class value:

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

	def compute(self):
		return self.f(self.v[0].v[0], self.v[1].v[0])
(add, sub, mul, pow, truediv, mod) = [type(f.__name__, (value,), {'f': f}) for f in [add, sub, mul, pow, truediv, mod]]