QOJ.ac

QOJ

시간 제한: 1 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓

#18485. 수학은 체육과목 입니다 3

통계

Lee Hwan is a genius 5-year-old baby living in the era of the 4th Industrial Revolution. One day, his kindergarten teacher recognized Hwan's genius and gave him the following problem:

"What is the sum of all integers from $A$ to $B$ inclusive?"

Hwan is a genius, but since he is still a baby, he doesn't really know what addition is. The next day, Hwan wrote down all integers from $A$ to $B$ inclusive in increasing order without any spaces in his notebook. For example, if $A = 4$ and $B = 21$, the answer Hwan wrote down is 456789101112131415161718192021.

Hwan is a genius with an extraordinary obsession with completing tasks, but his teacher is not. In fact, Hwan's teacher has even forgotten what the two numbers they called out yesterday were. The only information the teacher remembers is that both $A$ and $B$ were integers between $1$ and $999$ inclusive, and of course, $A$ was less than or equal to $B$.

Given the sequence of digits Hwan wrote down, can you find the two numbers the teacher called out?

Input

The first line contains a string $S$ representing the answer Hwan wrote down. $S$ consists only of digits (0123456789), and its length is between $1$ and $2\,889$ inclusive.

Output

Print the two integers $A$ and $B$ that the teacher called out, separated by a space. If there are two or more possible answers, print the one with the smallest $A$.

Since Hwan always writes the correct answer, only inputs for which a valid answer satisfying the conditions exists will be given.

Examples

Input 1

9101112

Output 1

9 12

Input 2

12

Output 2

1 2

Input 3

999

Output 3

999 999

Input 4

456789101112131415161718192021

Output 4

4 21

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.