Mohan and prime numbers in number plate

0

0 votes
Easy-Medium
Problem

Mohan is the head of the parking authority in an expensive mall so the ticket of parking is also expensive which is Rs 200. Now he has decided to give discount to those people whose number plate contains prime number, more the number of prime numbers more will be the discount. For every prime number he gives a discount of Rs 20. To minimize the time to calculate the number of prime numbers he wants you to write a code to calculate the number of prime numbers. For example 2571 contains prime numbers 2,5,7,71,257 and 571 so the total count is 6.

Input

First line contain t number of test cases. Next t lines contain number of the number plate.

Output

Discount Given by them in each case.

Sample input

1

2571

Sample output

120

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?