def func(d, cnt9, cnt0):

    if cnt9 < 1 : return d == 0

    n = int("9" * cnt9 + "0" * cnt0)

    return sum(func(d + i * n, cnt9 - 2, cnt0 + 1) * (9 - abs(i) + 1 - (cnt0 < 1)) for i in range(-9, 10) if abs(d + i * n) < n)



D = eval(input())

print(sum(func(D, i, 0) * (10 - i % 2 * 9) for i in range(1, 21)))
def func(d, x, y):

    n = int("9" * x + "0" * y)

    return d == 0 if x < 1 else sum(func(d + i * n, x - 2, y + 1) * (10 - abs(i) - (y < 1)) for i in range(-9, 10) if abs(d + i * n) < n)

D = eval(input());print(sum(func(D, i, 0) * (10 - i % 2 * 9) for i in range(1, 21)))
def func(d, cnt9, cnt0):
    if cnt9 < 1:
        return d == 0
    n = int("9" * cnt9 + "0" * cnt0)
    return sum(
        func(d + i * n, cnt9 - 2, cnt0 + 1) * (9 - abs(i) + 1 - (cnt0 < 1))
        for i in range(-9, 10)
        if abs(d + i * n) < n
    )


D = eval(input())
print(sum(func(D, i, 0) * (10 - i % 2 * 9) for i in range(1, 21)))

def func(d, x, y):
    n = int("9" * x + "0" * y)
    return (
        d == 0
        if x < 1
        else sum(
            func(d + i * n, x - 2, y + 1) * (10 - abs(i) - (y < 1))
            for i in range(-9, 10)
            if abs(d + i * n) < n
        )
    )


D = eval(input())
print(sum(func(D, i, 0) * (10 - i % 2 * 9) for i in range(1, 21)))

-def func(d, cnt9, cnt0): -    if cnt9 < 1: -        return d == 0 -    n = int("9" * cnt9 + "0" * cnt0) -    return sum( -        func(d + i * n, cnt9 - 2, cnt0 + 1) * (9 - abs(i) + 1 - (cnt0 < 1)) -        for i in range(-9, 10) -        if abs(d + i * n) < n +def func(d, x, y): +    n = int("9" * x + "0" * y) +    return ( +        d == 0 +        if x < 1 +        else sum( +            func(d + i * n, x - 2, y + 1) * (10 - abs(i) - (y < 1)) +            for i in range(-9, 10) +            if abs(d + i * n) < n +        )