No.1819 Mirrored 2
Problem Statement
For a positive integer $n$, let $\mathrm{rev}(n)$ be the integer obtained by reversing the decimal representation of $n$ (without leading $0$s). For example, $\mathrm{rev}(1234) = 4321$ and $\mathrm{rev}(5000) = 5$.
You are given primes $P,Q$ and positive integers $x,y$. Here, $P = 90007$. Report one positive integer $N$ not exceeding $10^{100000}$ that satisfies both of the following conditions.
- $N\bmod P=x$
- $\mathrm{rev}(N)\bmod Q=y$
It can be proved that, under the constraints of this problem, an $N$ satisfying the conditions always exists.
Constraints
- All inputs are integers.
- $P = 90007$
- $2\le Q < 10^{12}$
- $1\le x < P$
- $1\le y < Q$
- $P,Q$ are primes.
Input
$P$ $Q$ $x$ $y$
Output
Output one positive integer $N$ not exceeding $10^{100000}$ that satisfies the conditions. Print a newline at the end.
Note that omitting the newline or printing extra leading $0$s will be treated as WA.
Sample
Sample 1
Input
90007 73 1 1
Output
90008
$90008 \bmod 90007 = 1$, and $\mathrm{rev}(90008)=80009,80009 \bmod 73=1$, so the conditions are satisfied.
Many other correct answers are possible. Output any one of them.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
nok0
hir355
riano