SP7874 ADV04K - Calculator

Description

Once little Petya was learning positional numeral systems. Using such systems the numbers are represented as the sequence of digits _a_ $ _{n} $ _a_ $ _{n−1} $ … _a_ $ _{2} $ _a_ $ _{1} $ _a_ $ _{0} $ = _n_∑_k_=0 _a_ $ _{k} $ _b_ $ ^{k} $ ,

Input Format

The first line of input is number T - the amount of test cases. Next T lines contain the description of arithmetic expression consisting of two operands and an opertaion separated with spaces. Both operands consist of one ‘0’ and ‘1’ digits and have the length of no more than 100. Operation is one of ‘+’, ‘-’ or ‘\*’.

Output Format

For each test case output a number which is the result of evaluating the given expression.