P13442 [CodeChef] testtt5
NOI
题目描述

A robot named as Maestro, works on right most digit of number. For eg. 123456 is a number. Maestro would work with 6. But now, if number is 12345600. It will work with 6.

Input Specification

Input a variable t which is the number of test cases. Then input a string having alternate integers and multiplication characters. Your job is to calculate the last non zero digit in that mathematical expression.
Number can be as large as 10^19.
0 < t

Output Specification
Output consists of a single number which is the last non zero digit of the value of the expression.
If the expression evaluates to be zero, output should be “Robot hanged.”

Example

Sample Input:
2
2X3X7X5
2X0X4X25

Sample Output:
1
Robot hanged.

输入格式

见题面

输出格式

见题面

样例输入
2 2X3X7X5 2X0X4X25
样例输出
1 Robot hanged.