406199: GYM102309 A APA of Orz Pandas

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. APA of Orz Pandastime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

An Orz Panda team is participating a programming contest. They solved a problem mathematically but then they realized that this problem requires arbitrarily precision arithmetic (APA).

The Orz Pandas are too lazy to write APA themselves. They decide to use Java but as all we know Java do not support operator overloading. Soon their expression evolves to a monster:

a.add(b).remainder(M).multiply(d.substract(e.multiply(f)).add(g.divide(h))).multiply (BigInteger.ValueOf(233)) ... ...

Now can you write a tool to help the Orz Pandas to translate a normal C++ arithmetic expression into a Java BigInteger arithmetic expression?

Input

The input file contains multiple test cases. Please process until EOF.

Each test case contains one line, including an arithmetic expression. It's guaranteed that this expression only contains identifiers, brackets, binary operators "+", "-", "*", "/", and "%". And all identifiers only contain English letters.

The length of the expression will not exceed 1000.

Output

Output one line contains the Java BigInteger arithmetic expression.

This problem is not special judged so you should strictly keep the original ordering of the variables and evaluation, and do not add extra white spaces or brackets.

ExampleInput
a+b+c
(a+b)+c
a+(b+c)
(a+b)%(c+d)
Output
a.add(b).add(c)
a.add(b).add(c)
a.add(b.add(c))
a.add(b).remainder(c.add(d))

加入题单

算法标签: