class Solution:
def getImportance(self, employees: List['Employee'], id: int) -> int:
e = {a.id: a for a in employees}
def dfs(id):
return sum(dfs(x) for x in e[id].subordinates) + e[id].importance
return dfs(id)