AT_abc475_d [ABC475D] Alphametic Prime
Description
You are given a string $ S $ consisting of lowercase English letters. If there exists a prime number $ P $ satisfying the following condition, find one such $ P $ .
Condition: Let $ T $ be the string representing $ P $ in decimal notation without an extra leading `0`. Then, $ |S|=|T| $ , and for every $ 1\leq i< j \leq |S| $ , we have $ S_i=S_j $ if and only if $ T_i=T_j $ .
Input Format
The input is given from Standard Input in the following format:
> $ S $
Output Format
If there is no prime number satisfying the condition in the problem statement, output `-1`.
If one exists, output one such prime number. If there are multiple solutions, any of them will be accepted.
Explanation/Hint
### Sample Explanation 1
Besides this, for example, outputting `40709` would also be accepted. However, for example, `81817` does not satisfy the condition, so it would not be accepted.
### Sample Explanation 2
If there is no prime number satisfying the condition, output `-1`.
### Constraints
- $ S $ is a string of length between $ 1 $ and $ 7 $ (inclusive) consisting of lowercase English letters.