E. Easy Money
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

In the June of 2345 Bomboslav went to planet Nibiru for a summer internship as a barista in Bakefooc Inc. office there. As Bakefooc Inc. is a US-based company they continue to pay interns with cheques. Pay cheque is a paper document issued by an employer to pay an employee. Typically it is a piece of stamped paper with a sum and a signature of a head of payment department on it. You just bring this to any bank branch, wait for several days and enjoy the money being transferred to your account — what an easy and convenient way to be paid!

After two or three payments an evil plan came to Bomboslav's mind. What if he can scrap the upper layer of paper from the part where digits are written and stick them back in some order he might prefer more?

So he received his next pay cheque for $$$n$$$ nibidollars and successfully scrapped all the digits from it. He now wants to put them back in a following way.

  • All digits must be placed back to form a single valid integer (no leading zeroes are allowed) so no scrapped spot is visible.
  • Bomboslav believes in magic of numbers and wants to increase the chances of his shady transaction by obtaining an integer that is divisible by $$$7$$$.
  • The resulting integer should be as large as possible (Bomboslav is a greedy intern).

What is the best result he can get? Note that he is not allowed to form the original integer $$$n$$$ if it was not divisible by $$$7$$$.

Input

The only line of the input contains a single integer $$$n$$$ ($$$1 \leq n \lt 10^{1000}$$$) — the original sum in the pay cheque.

Output

If there is a way to obtain at least one integer that satisfies all the requirements, print maximum such integer in the only line of the output. Otherwise, print -1.

Examples
Input
14
Output
14
Input
11
Output
-1
Input
2020
Output
2002