Problem G: Calculator

## Problem G: Calculator

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 197  Solved: 46
[Submit][Status][Web Board]

## Description

You are asking to write a calculator which can do the following operations:+, -, *, /, ^ and ().

All input numbers are integers and no floating numbers appeared during the calculation.

## Input

The first line is the number of test cases, T (1 <= T <= 10)

For each test case, there is only one line with the expression. The input is always legal.

The length of expression will not exceed 50. And all median results don’t exceed 1000.

All input numbers are positive. All input expressions follow the rules in Math.

## Output

Print one integer in a single line for each test case, the result after calculation.

## Sample Input

1
5+6*3-2/2+1


## Sample Output

23


Bonus problem

[Submit][Status]