Happy pair of arrays
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Today everyone is celebrating Happy Numbers Day!
One of the traditional activities done on this day is checking various properties of happy numbers. For example, arrays \(a\) and \(b\) are considered a happy pair if for any \(a_i \in a\) and \(b_j \in b\) the condition holds that \(a_i + b_j\) is a happy number.
During the celebration, Petryk learned that Marichka’s favorite array \(a\) contains \(n\) \(\textbf{distinct}\) numbers. And Zenyk’s favorite array \(b\) contains \(m\) \(\textbf{distinct}\) numbers. He does not know the numbers themselves, but he is confident that Marichka’s and Zenyk’s arrays form a happy pair.
Tell him what the elements of Zenyk’s and Marichka’s arrays could be so that they form a happy pair. All elements must be within the range \([0, 2^{64})\).
Recall that a number is happy if its decimal representation contains only the digits 4 and 7.
Input
The single line contains two integers \(n\) and \(m\) – the sizes of Marichka’s array \(a\) and Zenyk’s array \(b\) respectively.
Output
In the first line, print \(n\) integers – possible elements of Marichka’s array \(a\).
In the second line, print \(m\) integers – possible elements of Zenyk’s array \(b\).
The elements of each array must be distinct non-negative integers within the range \([0, 2^{64})\).
For the given constraints, at least one solution always exists. If there are multiple solutions, print any.
Constraints
\(1 \le n, m \le 747\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 1 2 | 1 3 6 |
Notes
\(2^{64} \approx 1.8 \cdot 10^{19}\).
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|