def work_schedule(low, high):
    n = len(low)
    opt = [0] * (n+1)
    take_high_job = [False] * (n+1)

    # Can't make any money if we work 0 weeks
    opt[0] = 0
    # If we're only working one week, take the better of the two jobs.
    opt[1] = max(low[1], high[1])
    take_high_job[1] = high[1] > low[1]

    for i in range(2, n+1):

        # How much could we make taking the low or high stress job?
        low_total  = low[i] + opt[i-1]
        high_total = high[i] + opt[i-2]

        # The optimal for weeks 1..i is the higher of the two
        opt[i] = max(low_total, high_total)

        # Record which choice produced the higher total
        take_high_job[i] = high_total > low_total

    # Finally, produce a work schedule: work backwards from the end
    wk = n
    schedule = []
    while wk > 0:
        if take_high_job[wk]:
            schedule = ['off', 'HI'] + schedule
            wk -= 2
        else:
            schedule = ['LO'] + schedule
            wk -= 1

    return (opt[-1], schedule)
