import itertools as ite

import math

import random



INF = 10 ** 18

MOD = 10 ** 9 + 7



def func(diff, cnt9, cnt0):

    if cnt9 <= 0:

        return (diff == 0)

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

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



D = eval(input())



ans = 0

for d in range(1, 21):

    MUL = 1 if d % 2 == 1 else 10

    ans += func(D, d, 0) * MUL

print(ans)

import itertools as ite

import math

import random



INF = 10 ** 18

MOD = 10 ** 9 + 7



def func(diff, cnt9, cnt0):

    if cnt9 <= 0:

        return (diff == 0)

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

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



D = eval(input())



ans = 0

for d in range(1, 21):

    ans += func(D, d, 0) * (10 - d % 2 * 9)

print(ans)

import itertools as ite
import math
import random

INF = 10**18
MOD = 10**9 + 7


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


D = eval(input())
ans = 0
for d in range(1, 21):
    MUL = 1 if d % 2 == 1 else 10
    ans += func(D, d, 0) * MUL
print(ans)

import itertools as ite
import math
import random

INF = 10**18
MOD = 10**9 + 7


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


D = eval(input())
ans = 0
for d in range(1, 21):
    ans += func(D, d, 0) * (10 - d % 2 * 9)
print(ans)

-    MUL = 1 if d % 2 == 1 else 10 -    ans += func(D, d, 0) * MUL +    ans += func(D, d, 0) * (10 - d % 2 * 9)