# node implementation
class Node:
def __init__(self):
self.children = []
self.score = None
self.inner = None
def calculate(self):
if self.children == []:
return self.score
total = 0
items = 0
for i in self.children:
score = i.calculate()
if score != None:
items += 1
total += score