Go: package main

import (
	"bufio"
	"fmt"
	"go/token"
	"go/types"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	for i := 0; i < n; i++ {
		stdin.Scan()
		exp := strings.TrimRight(stdin.Text(), "=")
		res, _ := types.Eval(token.NewFileSet(), nil, token.NoPos, exp)
		fmt.Println(res.Value)
	}
}

Python: def ReversePolishNotation(string):

    priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2}

    stack = []
    signStack = ["Sentinel"]

    for item in string[:-1]:
        if item == "(":
            signStack.append(item)
        elif item == ")":
            while signStack[-1] != "(":
                stack.append(signStack.pop())
            signStack.pop()
        else:
            if item in priority.keys():
                if priority[signStack[-1]] < priority[item]:
                    signStack.append(item)
                else:
                    top = signStack.pop()
                    stack.append(top)
                    signStack.append(item)
            else:
                stack.append(item)

    while signStack[-1] != "Sentinel":
        stack.append(signStack.pop())

    return stack


def Calculate(formulaList):

    signs = ["+", "-", "*", "/"]

    stack = []

    for item in formulaList:

        if item not in signs:
            stack.append(item)
        else:
            num1 = int(stack.pop())
            num2 = int(stack.pop())

            result = 0

            if item == "+":
                result = num2 + num1
            elif item == "-":
                result = num2 - num1
            elif item == "*":
                result = num2 * num1
            else:
                result = num2 / num1

            stack.append(result)

    return int(stack[0])


inputCount = int(input())

for lp in range(inputCount):
    formula = input()

    rpn = ReversePolishNotation(formula)
    answer = Calculate(rpn)

    print(str(answer))

Python: l=[eval(input()[:-1]) for i in range(int(input()))]
[print(i) for i in l]

Python: import sys

while True:
    line = raw_input()
    if line == '':
        break

    for i in range(int(line)):
        a = eval(raw_input().replace('/', '//')[:-1])
        sys.stderr.writelines(a)

Python: for _ in range(int(input())):print(eval(input()[:-1].replace('/', '//')))

Python: for i in range(int(raw_input())):
    eval(raw_input()[:-1]);

Python: from collections import deque
from sys import stderr

def eva(l, r, op):
    if op == "+":
        return l + r
    elif op == "-":
        return l - r
    elif op == "*":
        return l * r
    elif op == "/":
        return l // r


def calc(exp):
    stderr.write(exp)
    i = 0
    num = deque()
    ops = deque()
    ope = ""
    while i < len(exp):
        if exp[i] == '(':
            end = exp[i:].rfind(")")
            num.append(calc(exp[i+1:i+end]))
            i += end + 1
            if ope:
                l = num.pop()
                r = num.pop()
                num.append(eva(l, r, ope))
                ope = ""
        if exp[i] in ["*", "/"]:
            ope = exp[i]
        elif exp[i] in ["+", "-"]:
            ops.append(exp[i])
        elif exp[i] == "=":
            pass
        else:
            temp = ""
            j = 0
            while i + j < len(exp) and exp[i+j].isnumeric():
                temp += exp[i+j]
                j += 1
            num.append(int(temp))
            i += j - 1
            if ope:
                num.append(eva(num.pop(), num.pop(), ope))
                ope = ""
        i += 1
    while len(ops) != 0:
        l = num.popleft()
        r = num.popleft()
        num.appendleft(eva(l,r,ops.popleft()))
    
    return num[0]


n = int(input())
for i in range(n):
    exp = input()
    print(calc(exp))

# N = int(input())
# for i in range(N):
#     print(int(eval(input().replace("/", "//").strip("="))))

Python: R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
 L=[];t=''
 for e in input()[:-1]:
  if e.isdigit():t+=e
  else:
   if t:L+=[t];t=''
   L+=e
 if t:L+=[t]
 P,S=[],[]
 for i in L:
  if"("==i:S+=i
  elif")"==i:
   while"("!=S[-1]:P+=S.pop()
   S.pop()
  elif i in R:
   while S and R[S[-1]]>=R[i]:P+=S.pop()
   S+=i
  else:P+=[i]
 while S:P+=S.pop()
 for x in P:
  S+=[str(int(eval(S.pop(-2)+x+S.pop())))if x in"+-*/"else x]
 print(*S)

Python: import re
class c:
    def __str__(self):
        return str(self.x)
    def __init__(self,value):
        self.x=value
    def __add__(self,value):
        return c(self.x+value.x)
    def __sub__(self,value):
        return c(self.x-value.x)
    def __mul__(self,value):
        return c(self.x*value.x)
    def __truediv__(self,value):
        return c(int(self.x/value.x))
n=int(input())
for i in range(n):
    s=input()[:-1]
    d=re.sub(r'(\d+)',r'c(\1)',s)
    #print(d)
    print(eval(d))
    #s.group(1)

Python: # -*- coding: utf-8 -*-

import sys
import os

n = int(input())

for i in range(n):
    command = input().strip()
    command = command.replace('=', '')
    command = command.replace('/', '//')
    print(eval(command))

Python: import re

class Num:
    def __init__(self, x):
        self.x = x

    def __str__(self):
        return str(self.x)

    def __add__(self, other):
        return Num(self.x + other.x)

    def __sub__(self, other):
        return Num(self.x - other.x)

    def __truediv__(self, other):
        return Num(int(self.x / other.x))

    def __mul__(self, other):
        return Num(self.x * other.x)

    def __neg__(self):
        return Num(-self.x)

n = int(input())
for _ in range(n):
    expr = input()[0:-1]
    expr = re.sub(r'(\d+)', r'Num(\1)', expr)
    print(eval(expr))

Python: #!/usr/bin/python3

n = int(input())

for _ in range(n):
    print(eval(input()[0:-1]))

Python: n=int(input())
for i in range(n):
    print(input())

Python: R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
 L=[];t=''
 for e in input()[:-1]:
  if e.isdigit():t+=e
  else:
   if t:L+=[t];t=''
   L+=e
 if t:L+=[t]
 P,S=[],[]
 for i in L:
  if"("==i:S+=i
  elif")"==i:
   while"("!=S[-1]:P+=S.pop()
   S.pop()
  elif i in R:
   while S and R[S[-1]]>=R[i]:P+=S.pop()
   S+=i
  else:P+=[i]
 while S:P+=S.pop()
 for x in P:
  S+=[str(eval(s.pop(-2)+p+s.pop()))if x in"+-*/"else x]
 print(*S)

Python: n=int(input())
for _ in range(n):
    s=input()
    s=s.replace("/","//")
    s=s[:-1:]
    print(eval(s))

Python: def seekBackOperatorInLand(op,s):
	depth = 0
	for i in xrange(len(s)-1,-1,-1):
		if s[i]==')': depth+=1
		if s[i]=='(': depth-=1
		if s[i]==op and depth==0: return i
	return None

def calc(s):
	if all(map(lambda t: t in "0123456789", s)):
		return int(s)
	if s[0]=='(' and s[-1]==')' and all(map(lambda t: t!='(' and t!=')', s[1:-1])):
		return calc(s[1:-1])
	
	p = seekBackOperatorInLand('-',s)
	if not p is None: return calc(s[:p])-calc(s[p+1:])
	p = seekBackOperatorInLand('+',s)
	if not p is None: return calc(s[:p])+calc(s[p+1:])
	p = seekBackOperatorInLand('/',s)
	if not p is None: return calc(s[:p])/calc(s[p+1:])
	p = seekBackOperatorInLand('*',s)
	if not p is None: return calc(s[:p])*calc(s[p+1:])

	return calc(s[1:-1])

def main():
	ol=input()
	for oi in xrange(ol):
		print(int(calc(raw_input()[:-1])))

main()

Python: n = int(input())
for _ in range(n):
    print(int(eval(input()[:-1])))

Python: while True:
  try:
    n=int(input())
    datasets=[input() for i in range(0,n)]
    for line in datasets:
      l = line.split("=",maxsplit=1)[0]
      print(int(eval(l)))
  except EOFError:
    break

Python: 
import re
n = int(input())
for i in range(n):
    s = raw_input().split('=')
    print(s)
    print(eval(s[0]))

Python: #!/usr/bin/python3

import re
n = int(input())
for _ in range(n):
    expr = input()[0:-1]
    expr = expr.replace('/', '//');
    print(eval(expr))

Python: N = int(input())
for i in range(N):
    print(eval(input().strip("=")))