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: inputs=[]
while True:
  try:
    inputs.append(input())
  except EOFError:
    break

for i in inputs:
  a,c=i.split("=")
  a,b=a.split("+")
  # a+b=c
  for x in range(0,10):
    if x==0 and (a[0]=="X" or b[0]=="X" or c[0]=="X"):
        next
    A=a.replace("X",str(x))
    B=b.replace("X",str(x))
    C=c.replace("X",str(x))
    if int(A)+int(B)==int(C):
      print(x)
      break
    if x == 9:
      print("NA")

Python: # -*- coding: utf-8 -*-
print(*[eval(input()[:-1].replace("/", "//")) for _ in range(int(input()))], sep="\n")

Python: T = int(input())
for tc in range(0,T) :
	print(int(eval(input().strip("="))))

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

Python: #n=int(input())

def lastfind(s,x):
    n=len(s)
    s_rev=s[::-1]
    t=s_rev.find(x)
    return n-t-1
def doublefind(s,x,y):
    if x in s:
        p=s.find(x)
    else:
        p=len(s)+10
    if y in s:
        q=s.find(y)
    else:
        q=len(s)+10
    
    if p<=q and p<len(s)+5:
        return [p,x]
    elif q<len(s)+5:
        return [q,y]
    else:
        return 0

def calculator(s):
    if s=="":
        return 0
    
    try:
        return int(s)
    except:
        try:
            x=doublefind(s,"+","-")
            if x[1]=="+":
                return calculator(s[:x[0]:])+calculator(s[x[0]+1::])
            else:
                return calculator(s[:x[0]:])-calculator(s[x[0]+1::])
        except:
            x=doublefind(s,"*","/")
            if x[1]=="*":
                return calculator(s[:x[0]:])*calculator(s[x[0]+1::])
            else:
                return calculator(s[:x[0]:])/calculator(s[x[0]+1::])

def calc(s):
    while "(" in s:
        closec=s.find(")")
        openc=lastfind(s[:closec:],"(")
        t=s[:openc:]+str(calculator(s[openc+1:closec:]))+s[closec+1::]
        s=t
    return calculator(s)
        
n=int(input())
for count in range(n):
    s=input()
    print(int(calc(s[:-1:])))

Python: import re
class c:
 def __init__(self,value):self.x=value
 def __str__(self):return str(self.x)
 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))
for i in[0]*int(input()):print(eval(re.sub(r'(\d+)',r'c(\1)',input()[:-1])))

Python: import re
class Num:
    def __str__(self):
        return str(self.x)
    def __init__(self, value):
        self.x = value
    def __add__(self, value):
        return Num(self.x + value.x)
    def __sub__(self, value):
        return Num(self.x - value.x)
    def __mul__(self, value):
        return Num(self.x * value.x)
    def __truediv__(self, value):
        return Num(int(self.x / value.x))

N = int(input())
for i in range(N):
    s = input()[:-1]
    s = re.sub(r'(\d+)',r'Num(\1)',s)
    print(eval(s))

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: [print(eval(input().replace("/","//")[:-1])) for _ in range(int(input()))]

Python: n = input()
for i in range(int(n)):
    command = input()
    answer = eval(command[0:-1])
    print(answer)

Python: # Aizu Problem 0109: Smart Calculator

#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


N = int(input())
for _ in range(N):
    print(eval(input().replace('=', '')))

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

Python: #n=int(input())

def lastfind(s,x):
    n=len(s)
    s_rev=s[::-1]
    t=s_rev.find(x)
    return n-t-1
def doublefind(s,x,y):
    if x in s:
        p=s.find(x)
    else:
        p=len(s)+10
    if y in s:
        q=s.find(y)
    else:
        q=len(s)+10
    
    if p<=q and p<len(s)+5:
        return [p,x]
    elif q<len(s)+5:
        return [q,y]
    else:
        return 0

def calculator(s):
    if s=="":
        return 0
    
    try:
        return int(s)
    except:
        try:
            x=doublefind(s,"+","-")
            if x[1]=="+":
                return calculator(s[:x[0]:])+calculator(s[x[0]+1::])
            else:
                return calculator(s[:x[0]:])-calculator(s[x[0]+1::])
        except:
            x=doublefind(s,"*","/")
            if x[1]=="*":
                return calculator(s[:x[0]:])*calculator(s[x[0]+1::])
            else:
                return int(calculator(s[:x[0]:])/calculator(s[x[0]+1::]))
def remove_brackets(s):
    if s[0]=="(" and s[-1]==")":
        return s[1:-1:]
    else:
        return s
def calc(s):
    while "(" in s:
        closec=s.find(")")
        openc=lastfind(s[:closec:],"(")
        s=s[:openc:]+str(calculator(s[openc+1:closec:]))+s[closec+1::]
    return calculator(s)
        
n=int(input())
for count in range(n):
    s=input()
    print(calc(s[:-1:]))

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())

            if item == "+":
                result = num2 + num1
            elif item == "-":
                result = num2 - num1
            elif item == "*":
                result = num2 * num1
            elif item == "/":
                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(answer)