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.

FACT_FUN - H Function

H(x) equals to sum of all digits of x. Moreover, if H(x)>9 then H(x)=H(H(x)).

Input

The first line of the standard input contains one integer t (t<100001) - the number of test cases.

In each of the next t lines there is one number x (x<106).

Output

For each test You have to print H(x!).

Example

Input:
2
1
5

Output: 1
3


Added by:Piotr Kąkol
Date:2011-09-11
Time limit:5s-10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi
Resource:Copy of HFUN with bigger time limit and all available languages

hide comments
2014-02-27 03:22:27 Mitch Schwartz
Oh I forgot about that. I also had modified my BF program to pass there before noticing it wasn't allowed (a few months ago). :(

Last edit: 2014-02-27 06:19:10
2014-02-25 23:18:10 Piotr KÄ…kol
Unfortunately, Bash is not allowed in HFUN.
2014-02-25 17:34:50 Mitch Schwartz
@Sebastian Jakubiak: If your 28-byte bash solution works with "\r\n" newlines, you could take top spot in HFUN. :)
2013-11-25 03:46:25 Linghui Liu
@Piotr Kąkol,@Mitch Schwartz Thank you. I made a silly mistake.

I note that submitting file is always one more byte than source editing since the system will append '\n'.

Last edit: 2013-11-25 04:12:26
2013-11-24 16:53:30 Piotr KÄ…kol
In HFUN you probably have two additional endlines at the end of your code.
As for SED, you don't read the number of tests. The Levensthein distance from your code to a valid code equals 3. ;-)
2013-11-23 23:36:51 Mitch Schwartz
@Linghui Liu: I believe the standard judge is being used for both problems, and the score is precisely your source length. Maybe there is some extra whitespace in your 41-byte code; you could also experiment with submitting a file instead of copying and pasting into the text box.
2013-11-23 15:32:04 Linghui Liu
Oddly,for same awk code here 39, but HFUN 41. And I don't know why the 29-byte sed code WA, I tested all small cases.
2013-09-12 20:16:35 Jander
Thank you for the hint Mitch - indeed \r\n seems to be the issue with HFUN. Shame that you beat me to it ;-)
2013-09-12 19:45:51 Mitch Schwartz
Haha. :) HFUN has "\r\n" newlines, I'm sure that's the reason.
2013-09-12 19:42:07 Jander
Snigger :-)

Oddly, this sed answer doesn't work for HFUN.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.