Let $n$ be a positive integer. In JMO kingdom there are $2^n$ citizens and a king. In terms of currency, the kingdom uses paper bills with value \$$2^n$ and coins with value \$$2^a(a=0,1\ldots ,n-1)$. Every citizen has infinitely many paper bills. Let the total number of coins in the kingdom be $S$. One fine day, the king decided to implement a policy which is to be carried out every night:
[list][*] Each citizen must decide on a finite amount of money based on the coins that he currently has, and he must pass that amount to either another citizen or the king;
[*]Each citizen must pass exactly \$1 more than the amount he received from other citizens. [/list]

Find the minimum value of $S$ such that the king will be able to collect money every night eternally.
1. **Define the sum of digits function**: For an integer \( a \geq 0 \), let \( s(a) \) be the sum of the digits of \( a \) in base two. This function counts the number of 1s in the binary representation of \( a \).

2. **Determine the total number of coins**: We need to find the minimum value of \( S \) such that the king can collect money every night eternally. The answer is \( n2^{n-1} \). 

3. **Assign coins to citizens**: Number the citizens \( 0, 1, \ldots, 2^n - 1 \). For citizen number \( a \) (where \( a = 0, 1, \ldots, 2^n - 1 \)), give them \( s(a) \) coins corresponding to the binary representation of \( a \). 

4. **Describe the coin passing process**: Each citizen \( a \) gives all their coins to citizen \( a+1 \) (where citizen \( 2^n \) is citizen \( 0 \)), and citizen \( 0 \) gives a bill to the king. 

5. **Verify the process can go on forever**: It is easy to see that the above procedure can go on forever. Each citizen passes exactly 1 more than the amount they received, ensuring the process is sustainable.

6. **Calculate the total number of coins used**: The total number of coins used is \( s(0) + s(1) + \cdots + s(2^n - 1) \). Since there are \( n \) coin denominations, and \( 2^{n-1} \) people have each denomination, we have:
   \[
   s(0) + s(1) + \cdots + s(2^n - 1) = n2^{n-1}
   \]

7. **Prove the minimum number of coins**: Since the number of coins is finite, at some point it stays constant forever. Let this day be day \( 0 \). Consider days \( 0, 1, \ldots, 2^n - 1 \). Throughout these \( 2^n \) days, each citizen has a different amount of money from \( 0, 1, \ldots, 2^n - 1 \pmod{2^n} \). This means that, summing across these \( 2^n \) days, each citizen has at least \( s(0) + s(1) + \cdots + s(2^n - 1) \) coins. Therefore, the total number of coins is at least:
   \[
   2^n(s(0) + s(1) + \cdots + s(2^n - 1))
   \]
   However, each coin is counted \( 2^n \) times (once for each day), so the number of coins is at least:
   \[
   s(0) + s(1) + \cdots + s(2^n - 1) = n2^{n-1}
   \]

Thus, the minimum value of \( S \) such that the king will be able to collect money every night eternally is \( n2^{n-1} \).

The final answer is \( \boxed{n2^{n-1}} \).