#P14605. [NWRRC 2025] Faulty Fraction

[NWRRC 2025] Faulty Fraction

题目描述

Felix is studying basic arithmetic at school. Today he learned division. As a final task, he calculated the result of the division of a positive integer aa by a positive integer bb. The result was a positive integer cc, since aa was divisible by bb. Felix wrote a÷b=ca \div b = c in his notebook and went outside to play football.

His little sister Fiona had been watching his studies with great interest. When Felix left, she decided to play a little trick on him: she took his notebook and erased the ÷\div sign from the equation. As a result, the left-hand side of the equation became a single string of digits ss.

Once Felix came back, he saw s=cs = c in his notebook. Unfortunately, he forgot the original values of aa and~bb. Now he needs to split ss back into two parts using the ÷\div sign to restore a correct division equation.

Help Felix find positive integers aa and bb such that ss is the concatenation of the decimal representations of aa and bb, and a÷b=ca \div b = c.

输入格式

The only line contains a string of digits ss and an integer cc. Both ss and cc consist of at least 11 and at most 10510^5 digits and do not have leading zeros.

It is guaranteed that ss is a concatenation of two positive integers aa and bb written without leading zeros such that a÷b=ca \div b = c.

输出格式

Print two positive integers aa and bb without leading zeros such that ss is the concatenation of aa and bb, and a÷b=ca \div b = c. If there are multiple answers, print any of them.

42 2
4 2
2025225 9
2025 225
239239239 1001
239239 239