@cache
def presents_for_house(house):
    '\n    https://math.stackexchange.com/a/22744\n\n    >>> presents_for_house(1)\n    10\n    >>> presents_for_house(2)\n    30\n    >>> presents_for_house(3)\n    40\n    >>> presents_for_house(8)\n    150\n    >>> presents_for_house(9)\n    130\n    '
    if (house == 1):
        return 10
    presents = 0
    sign = sigma_sign_generator()
    for p in sigma_pentagonal_numbers(house):
        n = (house - p)
        if (n == 0):
            presents += ((house * next(sign)) * 10)
        else:
            presents += (presents_for_house(n) * next(sign))
    return presents
https://math.stackexchange.com/a/22744

>>> presents_for_house(1)
10
>>> presents_for_house(2)
30
>>> presents_for_house(3)
40
>>> presents_for_house(8)
150
>>> presents_for_house(9)
130
@cache
def presents_for_house(house):
    '\n    https://math.stackexchange.com/a/22744\n\n    >>> presents_for_house(1)\n    10\n    >>> presents_for_house(2)\n    30\n    >>> presents_for_house(3)\n    40\n    >>> presents_for_house(8)\n    150\n    >>> presents_for_house(9)\n    130\n    '
    if (house == 1):
        return 10
    presents = 0
    sign = sigma_sign_generator()
    for p in sigma_pentagonal_numbers(house):
        n = (house - p)
        if (n == 0):
            presents += ((house * next(sign)) * 10)
        else:
            presents += (presents_for_house(n) * next(sign))
    return presents