#P5965. [PA 2019] A+B

[PA 2019] A+B

Description

When writing down the vertical addition of two decimal numbers, people may miscalculate it like this:

In the left part of the picture, 248+208248+208 is wrongly calculated as 44164416.

Given a positive integer nn, ask how many pairs of non-negative integers a,ba,b satisfy that a+ba+b would be miscalculated as nn.

Note that aa may be equal to bb, and a=1,b=2a=1,b=2 and a=2,b=1a=2,b=1 are considered two different solutions.

Input Format

The first line contains a positive integer nn.

Output Format

Output an integer, the number of pairs a,ba,b that satisfy the condition.

112
50

Hint

For 100%100\% of the testdata, 1n<10181\le n<10^{18}.

Translated by ChatGPT 5