Arithmetic Operations With Large Integers

This problem is about calculations with large numbers. Large means numbers with at most one thousand digits. The operations are limited to addition, substraction, multiplication and raising to a higher power. There are no limitations to the operants of addition, substraction and multiplication. The base in raising to higher powers is positive and smaller than ten. The exponent is positive. The inputfile consists of a valid expression with any number of operations. There are no parentheses, but the normal arithmetic priority rules are still valid. An example of a valid expression is: 12345678 * 129876 + 21993. An invalid expression is: 12345678 * 129876 + 121993 because the base is greater than nine. Input The input contains several test cases, each one on a different line. Each test case contains numbers and operands in the following way: nopn{opn }. n is a positive decimal number with at most one thousand digits, stored as an ASCII-text. op is one of the following: ‘+’, ‘-’, ‘’, ‘’ ( means “raising to higher powers”). There can be at most one hundred operations per test case. There are no spaces or other illegal characters in the input. Output The output contains the exact result of the evaluated expressions given in the input. Print each test case in a different line (in the sample below, the output line is splited by visual reasons, but it must be just a line in your output). Each test case won’t have more than three thousand characters. Sample Input 12345678129876+2**1993 Sample Output 896977105683011347056900938420064050017435704756793125373158388145129891712\ 789307700515223684770523373785909874208955291755561688174261977676508872005\ 197801086953040197752187505381087095625350558038492109870986287356370809737\ 409093338414265941143390397695285610643740694879918793932122262001282984143\ 224073001319601441082075018589725061828585163552941409601583724270514300953\ 188533095947591884905338415676554651534516617357655143781579373852994152663\ 198702360093129335607684294312805938140290754926427776409574872859496315224\ 893901812925850900592061583009183090068756428459147015355107518672556877720