FAVDICE - Favorite Dice

BuggyD loves to carry his favorite die around. Perhaps you wonder why it's his favorite? Well, his die is magical and can be transformed into an N-sided unbiased die with the push of a button. Now BuggyD wants to learn more about his die, so he raises a question:

What is the expected number of throws of his die while it has N sides so that each number is rolled at least once?

Input

The first line of the input contains an integer t, the number of test cases. t test cases follow.

Each test case consists of a single line containing a single integer N (1 <= N <= 1000) - the number of sides on BuggyD's die.

Output

For each test case, print one line containing the expected number of times BuggyD needs to throw his N-sided die so that each number appears at least once. The expected number must be accurate to 2 decimal digits.

Example

Input:
2
1
12

Output:
1.00
37.24

Added by:Matthew Reeder
Date:2006-10-29
Time limit:1s
Source limit:30000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Al-Khawarizm 2006

hide comments
2021-10-19 12:28:19
guys use double otherwise you get WA
2020-07-24 10:28:20
Coupon collector problem. #math,#linear recurrence
2020-06-14 23:38:58
Prerequisite : Coupon Collector Problem
2020-01-31 12:56:25
straightforward application of random processes.
2019-07-15 06:25:38
Search Coupon collector problem without this its very difficult to think logic of this problem
2018-10-12 19:10:48
learned something new .. CCP * __ *
2018-06-29 09:48:02
Maths has never been my thing. Took some time to understand the Coupon Collector problem.
Simple code but good maths concept.
2017-10-24 19:13:39
Coupon collector problem.............AC in a go...
2017-06-09 09:16:54
Coupon Collector Problem:
https://www.youtube.com/watch?v=3mu47FWEuqA

Last edit: 2017-06-09 09:17:07
2017-05-06 19:45:32
Simple Probabilty problem. #math tag.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.