def calculate_total_bags(graph):
    """
    Given a graph, return the total bags required
    """
    value = 0
    for node in graph:
        value += int(node["count"]) + int(node["count"]) * calculate_total_bags(
            node["inside"]
        )
    return value