def part2(data):
    '\n    >>> part2(INPUT)\n    786240\n    '
    upper_limit = INPUT
    house = ([0] * (upper_limit + 1))
    elf = 1
    while (elf <= upper_limit):
        elf_end = min((elf * 50), upper_limit)
        for number in range(elf, (elf_end + 1), elf):
            index = (number - 1)
            house[index] += (11 * elf)
            if (house[index] >= data):
                upper_limit = min(number, upper_limit)
        elf += 1
    for (i, value) in enumerate(house):
        if (value >= data):
            return (i + 1)
    raise ValueError()
>>> part2(INPUT)
786240
def part2(data):
    '\n    >>> part2(INPUT)\n    786240\n    '
    upper_limit = INPUT
    house = ([0] * (upper_limit + 1))
    elf = 1
    while (elf <= upper_limit):
        elf_end = min((elf * 50), upper_limit)
        for number in range(elf, (elf_end + 1), elf):
            index = (number - 1)
            house[index] += (11 * elf)
            if (house[index] >= data):
                upper_limit = min(number, upper_limit)
        elf += 1
    for (i, value) in enumerate(house):
        if (value >= data):
            return (i + 1)
    raise ValueError()