eolymp
bolt
Try our new interface for solving problems
Problems

Beautiful numbers

Beautiful numbers

You probably noticed that many companies use "beautiful" phone numbers for advertising that are convenient for potential customers to remember. But what if your company number is unremarkable? You can take a closer look at it, and suddenly, if you rearrange the numbers in some way, the number will become much more beautiful? For example, if your company has the number 872-73-33, then it can be made more beautiful if you rearrange the numbers like this: 8727-333.

Let us introduce the following value of the beauty of partitioning a number. We will break the number with hyphens into groups of sizes from 2 to 4 digits. Now, the beauty of the partition is the sum of the points that each group brings. We will consider these points using the following table.

prb2225.gif

In this table, the symbols "a", "b", "c" indicate different numbers. For example, the groups "223", "667" are suitable for the template "aab", but "123" and "888" are not suitable.

Using the proposed evaluation, find the most beautiful partition of the given number.

Input

Contains one line with 7 digits - the given phone number.

Output

Print in the first line the most beautiful partition of the number, and in the second - the value of its beauty. If there are several partitions with the maximum value of beauty, output any of them.

Time limit 1 second
Memory limit 128 MiB
Input example #1
8727333
Output example #1
8727-333
5
Input example #2
8827291
Output example #2
88-272-91
4
Source 2006, XIV St. Petersburg School Programming Team Championship, November 6, Problem I