Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

Problem hidden on 2014-04-11 19:55:40 by Francky

LASTD - The last Digit

no tags 

Once, a very smart guy who was able to do any arithmetic operation with big numbers had his brother kidnapped. However the kidnappers didn't wanted money for returning his brother but wanted him to answer a math question because they needed it ( nobody knows why :O ) , the problem they gave to him had a simple question , find the last digit of the given expression.

Input

On the first line there is number T <=50 the  number of test cases, then every test case has a single line which contains the expression, the length of the expression is no more than 1000 and the operations are not prioritized which means that you need to do the operations in the order they are given, but for making it more difficult kidnappers added some random symbols in the expression , you need to ignore them . It is guaranted that all the numbers are integers and there will be only 3 arithmetic operations + - and *.

Output

Exactly T lines each represetning the last digit of the expression.

Example

Input:
2
123n*11
12*njkm2
Output:
3
4

hide comments
[Lakshman]: 2014-04-12 12:25:42

@Safrastyan Does input contains multiple operator? If so why my new code getting NZEC.

Last edit: 2014-04-12 12:32:29
Francky: 2014-04-12 11:12:22

Problem too easy for classical -> tutorial.
Description is far from complete. Hidden. Please let a new comment when the description is full.

Bhavik: 2014-04-12 11:12:22

what can be the mathematical operators? +,-,*,/ or more... specify plz
what can be the random symbols(a-z)(A-Z)??

Last edit: 2014-04-11 19:27:44

Added by:x
Date:2014-04-11
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:own