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: # Edit: 2014/09/26
# Lang: Python3
# Time: 0.xxs
#

if __name__ == "__main__":
    n = int(input())
    for i in range(n):
        print(eval(input().strip("=").replace("/", "//")))

Python: n = int(input())
for _ in range (n):
    print(eval(input().rstrip('=').replace('/','//')))

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

Python: def calc(eqt):
  l = eqt.split("+",maxsplit=1)
  if len(l) == 2:
    return (calc(l[0])+calc(l[1]))
  l = eqt.split("-",maxsplit=1)
  if len(l) == 2:
    return (calc(l[0])-calc(l[1]))
  l = eqt.split("*",maxsplit=1)
  if len(l) == 2:
    return (calc(l[0])*calc(l[1]))
  l = eqt.split("/",maxsplit=1)
  if len(l) == 2:
    return (calc(l[0])//calc(l[1]))
  return (int(eqt))

def unfold_brackets(eqt):
  l = eqt.split(')',maxsplit=1)
  if len(l) == 1:
    return calc(eqt)
  else:
    ll = l[0].rsplit('(',maxsplit=1)
    ll.append(l[1])
    ll[1] = str(calc(ll[1]))
    l="".join(ll)
    return unfold_brackets(l)

n=int(input())
datasets=[input() for i in range(n)]
for line in datasets:
  l = line.split("=",maxsplit=1)[0]
  print(unfold_brackets(l))

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0109&lang=jp

"""
import sys
from sys import stdin
import re
input = stdin.readline


class SmartInt(int):
    def __truediv__(self, other):
        sign = 1
        if self.n < 0:
            sign = -1
            self.n *= -1
        return (self.n // other) * sign


def main(args):
    n = int(input())
    for _ in range(n):
        # txt = '4*(8+4+3)='
        txt = input().strip()
        p = re.sub('(\d+)', 'SmartInt(\\1)', txt)
        exp = p[:-1]
        print(eval(exp))


if __name__ == '__main__':
    main(sys.argv[1:])

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

Python: def calc(eqt): # assuming that eqt has no brackets.
  l = eqt.split("+",maxsplit=1)
  if len(l) == 2: # if eqt has "+", then
    return (calc(l[0])+calc(l[1]))
  l = eqt.split("-",maxsplit=1)
  if len(l) == 2:# if eqt has "-", then
    return (calc(l[0])-calc(l[1]))
  l = eqt.split("*",maxsplit=1)
  if len(l) == 2:# if eqt has "*", then
    return (calc(l[0])*calc(l[1]))
  l = eqt.split("/",maxsplit=1)
  if len(l) == 2:# if eqt has "/", then
    return (calc(l[0])/calc(l[1]))
  return (int(eqt))

def unfold_brackets(eqt): # for example, eqt == "((3+5)*8+2)*2"
  l = eqt.split(')',maxsplit=1)
  if len(l) == 1: # if eqt has no brackets, then
    return calc(eqt)
  else:
    # for example, l == ["((3+5", "*8+2)*2"]
    ll = l[0].rsplit('(',maxsplit=1)
    # ll == ["(","3+5"]
    ll.append(l[1])
    # ll == ["(","3+5","*8+2)*2"]
    ll[1] = str(calc(ll[1]))
    # ll == ["(",8,"*8+2)*2"]
    l="".join(ll)
    # ll == "(8*8+2)*2"
    return unfold_brackets(l)

n=int(input())
datasets=[input() for i in range(0,n)]
for line in datasets:
  l = line.split("=",maxsplit=1)[0]
  print(unfold_brackets(l))

Python: import math
def calc_zyouzyo(siki) :
    j = 0
    while True :
        if '*' not in siki and '/' not in siki:
            break
        if siki[j] == '*' :
            siki[j-1] = str(int(siki[j-1]) * int(siki[j+1]))
            del siki[j:j+2]
        elif siki[j] == '/' :
            if (int(siki[j-1]) < 0 and int(siki[j+1]) < 0) or (int(siki[j-1]) >= 0 and int(siki[j+1]) >= 0) :
                siki[j-1] = str(int(siki[j-1]) // int(siki[j+1]))
            else :
                if int(siki[j-1]) % int(siki[j+1]) == 0 :
                    siki[j-1] = str(int(siki[j-1]) // int(siki[j+1]))
                else :
                    siki[j-1] = str(int(siki[j-1]) // int(siki[j+1]) + 1)
            del siki[j:j+2]
        else :
            j += 1
    if len(siki) == 1 :
        return(siki[0])
    else :
        return(siki)
    
def calc_kagen(siki) :
    j = 0
    while True :
        if '+' not in siki and '-' not in siki:
            break
        if siki[j] == '+' :
            siki[j-1] = str(int(siki[j-1]) + int(siki[j+1]))
            del siki[j:j+2]
        elif siki[j] == '-' :
            siki[j-1] = str(int(siki[j-1]) - int(siki[j+1]))
            del siki[j:j+2]
        else :
            j += 1
    if len(siki) == 1 :
        return(siki[0])
    else :
        return(siki)

def calc(siki) :
    siki = calc_zyouzyo(siki)
    siki = calc_kagen(siki)
    return(siki)

n = int(input())
for i in range(n) :
    tmp = list(input())
    siki = []
    num = ''
    for j in range(len(tmp)) :
        if tmp[j] in ['*', '/', '+', '-', '(', ')', '='] :
            if num != '' :
                siki.append(num)
            siki.append(tmp[j])
            num = ''
        else :
            num += tmp[j]
    siki.remove('=')
    j = 0
    while True :
        if j == len(siki) or ')' not in siki:
            break
        stack = []
        if siki[j] == ')' :
            for k in range(j-1,-1, -1) :
                if siki[k] == '(' :
                    break
                else :
                    stack.append(siki[k])
            stack.reverse()
            siki[k] = calc(stack)
            del siki[k+1 : j+1]
            j = k+1
        else :
            j += 1
    siki = calc(siki)
    print(siki)

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

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

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

Python: for _ in range(input()):print(eval(raw_input()[:-1]))

Python: # -*- coding: utf-8 -*-
# 写経した
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(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))