cho.sh
Notes
Loading...

Friendly Brothers

Time limit

2s

Memory limit

128 MB

Problem

Youngsik and Minsik are sharing a cake. Whenever someone takes a turn, that person eats exactly half of the cake that remains.

If they alternate in the order Youngsik, Minsik, Youngsik eats the following amounts.

YoungsikMinsik
1/21/4
1/81/16
1/321/64
1/1281/256
......

In this case, Youngsik eats 2/3 of the whole cake, and Minsik eats 1/3.

Now the two brothers will repeat a fixed pattern forever. Each character of the pattern represents one turn; after the last character, the pattern starts again from the beginning. Youngsik is written as *, and Minsik is written as -.

For the repeated pattern Youngsik, Minsik, Youngsik, the amounts are taken as follows.

YoungsikMinsikYoungsik
1/21/41/8
1/161/321/64
1/1281/2561/512
.........

With this pattern, Youngsik eats 5/7 of the whole cake.

You are given the target amount of cake Youngsik must eat as a reduced fraction a/b. Find the shortest repeating pattern that makes Youngsik eat exactly that amount.

Input

The first line contains two integers a and b. They are the numerator and denominator of the reduced fraction a/b.

Output

Print the eating pattern on the first line. In the pattern, print Youngsik's turns as * and Minsik's turns as -.

If no pattern of length at most 60 exists, print -1. If multiple patterns are possible, print the shortest one.

Constraints

  • 0 <= a <= b <= 2^63 - 1
  • a and b are relatively prime.