AT_abc387_e [ABC387E] Digit Sum Divisible 2

Description

The digit sum of a positive integer $ n $ is defined as the sum of its digits when $ n $ is written in decimal. For example, the digit sum of $ 2025 $ is $ 2 + 0 + 2 + 5 = 9 $ . A positive integer $ n $ is called a **good integer** if it is divisible by its digit sum. For example, $ 2025 $ is a good integer because it is divisible by its digit sum of $ 9 $ . A pair of positive integers $ (a, a+1) $ is called **twin good integers** if both $ a $ and $ a+1 $ are good integers. For example, $ (2024, 2025) $ is twin good integers. You are given a positive integer $ N $ . Find a pair of twin good integers $ (a, a + 1) $ such that $ N \leq a $ and $ a + 1 \leq 2N $ . If no such pair exists, report that fact.

Input Format

The input is given from Standard Input in the following format: > $ N $

Output Format

If there exists such a pair $ (a, a+1) $ , output $ a $ . Otherwise, output `-1`. Do not print leading zeros. If there are multiple such pairs, you may print any.

Explanation/Hint

### Sample Explanation 1 $ (8, 9) $ is a valid pair of twin good integers satisfying the conditions. Other examples include $ (5, 6), (6, 7), (7, 8), (9, 10) $ . ### Sample Explanation 2 No pair of twin good integers satisfies the conditions. ### Sample Explanation 3 $ (2024, 2025) $ is a valid pair of twin good integers. ### Constraints - $ N $ is an integer at least $ 1 $ and less than $ 10^{100000} $ .