Banner Home Page DIY Contests Problems Ranklist Status Statistics

YouKnow

Time Limit : 1500/500ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 7   Accepted Submission(s) : 0

Font: Times New Roman | Verdana | Georgia

Font Size: ¡û ¡ú

Problem Description

As is known to us,WY loves to play Uno.Uno is an American card game
which is played with a specially printed deck . The game was originally
developed in 1971 by Merle Robbins in Reading, Ohio, a suburb of Cincinnati.
It has been a Mattel product since 1992. The game's general principles
put it into the Crazy Eights family of card games.The following are official
rules of Uno:
The deck consists of 108 cards, of which there are twenty-five of each
color (red, green, blue, and yellow), each color having two of each rank
except zero. The ranks in each color are zero to nine, "Skip", "Draw Two"
and "Reverse" (the last three of these being classified as "action cards").
In addition, the deck contains four each of "Wild" and "Wild Draw Four" cards.
To start a hand, seven cards are dealt out to each player, and the top card
of the deck is flipped over and set aside to begin the discard pile. The player
to the dealer's left plays first, unless the first card on the discard pile is an action
or Wild card (see below). On a player's turn, he/she must do one of the following:
1.play a card matching the discard in color, number or symbol
2.play a Wild card, or a playable Wild Draw Four card (see restriction below)
3.draw the top card of the deck
4.If a player chooses to draw the top card of the deck, and that card is playable
(it matches the discard, or is a playable wild card), then the player may (but need not)
immediately play that card.
Play proceeds clockwise around the table.
a.A player who plays his/her next-to-last card must call "uno" as a warning to the others.
b.The first player to get rid of his/her last card ("going out") wins the hand and scores
points for the cards held by the other players. Number cards count their face value,
all action cards count twenty, and Wild and Wild Draw Four cards count fifty. If a Draw Two or Wild Draw Four card is played to go out, the next player in sequence must draw the appropriate number of cards before the score is tallied.
c. The first player to reach five hundred points is the winner.

Though WY loves to play uno ,kdwycz likes play the game YouKonw.The rule of YouKonw
is simple¡ª¡ªcalculate the result of S(n)
The sequence S(n) is defined as following:
S(1)=0,
S(2)=10,
S(3)=1110,
S(4)=3110,
S(5)=132110,
¡­¡­
But kdwycz is not good at calculate,he ask you for help.

Input

The input consists of multiple test cases. Each test case contains one integers n.
(1<=n<=30)
n=0 signal the end of input.

Output

S(n)

Sample Input

2
5
0

Sample Output

10
132110

Author

MummyDing

Statistic | Submit | Back