Multiplication Improvement

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

zxyl has improved significantly at computer science. On the other hand, he hasn't improved as much in math. Especially multiplication.

He cannot understand an expression if the numbers are not in increasing order. For example, he can understand 1x4x7x9 but he cannot understand 9x4x7x1.

Given an expression, help zxyl understand the expression and calculate it.

Input Specification

The one and only line of input will contain a string S, whose length L is (1 \le L \le 39), containing a sequence of one digit numbers and the character x.

Output Specification

The first line of output should be the expression in a way that zxyl can understand it.

The last line of output will be the solution to the expression.

The output will always be under 2^{64}-1.

Sample Input 1

5x4x9

Sample Output 1

4x5x9
180

Comments

There are no comments at the moment.