def METHOD_NAME(ranges):
    ranges = list(sorted(ranges, key=lambda x: x[0]))
    if len(ranges) < 2:
        return ranges
    ret = [ranges[0]]
    for cur in ranges[1:]:
        last = ret[-1]
        last_end = last[0] + last[1]
        if last_end < cur[0]:
            ret.append(cur)
        else:
            cur_end = cur[0] + cur[1]
            last = (last[0], max(last_end, cur_end) - last[0])
            ret[-1] = last
    return ret