def get_weight(programs, program):
    """Get weight of program including above programs."""
    cur_program = programs[program]
    if not cur_program['above']:
        return cur_program['weight']
    weights_above = [get_weight(programs, above)
                     for above in cur_program['above']]
    return cur_program['weight'] + sum(weights_above)