Flipper#1189

Flipper

1 second
32 megabytes
Medium

Little Bobby Roberts (son of Big Bob, of Problem G) plays this solitaire memory game called Flipper. He starts with cards, numbered through , and lays them out in a row with the cards in order left-to-right. (Card is on the far left; card is on the far right.) Some cards are face up and some are face down. Bobby then performs n - 1 flips — either right flips or left flips.

In a right flip, he takes the pile to the far right and flips it over onto the card to its immediate left. For example, if the rightmost pile has cards , , (from top to bottom) and card is to the immediate left, then flipping the pile over onto card would result in a pile of cards: , , , (from top to bottom). A left flip is analogous.

After the very last flip, there will be a single pile of cards — some face up, some face down. For example, suppose Bobby deals out cards (numbered through ) with cards through initially face up and cards and initially face down. If Bobby performs right flips, then left flips, the pile will be (from top to bottom) a face down , a face up , a face up , a face down , and a face up .

Now Bobby is very sharp and you can ask him what card is in any position and he can tell you! You will write a program that matches Bobby’s amazing feat.

Input

Each test case consists of lines. The first line contains a positive integer (2 \leq n \leq 100) — the number of cards laid out. The second line is a string of characters. Character indicates the corresponding card is dealt face up and character indicates the card is face down. The third line is a string of n - 1 characters showing the order of flips Bobby performs. Each character is either (right flip) or (left flip). The fourth line is of the form m\ q_1\ q_2\ \ldots\ q_m, where is a positive integer and 1 \leq q_i \leq n. Each q_i is a query for the card's position in the pile ( is the top card, is the bottom card). A line containing indicates end of input.

Output

For each test case, output m + 1 lines. The first line should be:

Pile

where is the test case number (starting at ). Each of the next lines should be

Card q_i is a face up .

or

Card q_i is a face down .

accordingly, for i = 1, \ldots, m, where is the card number.

For example, in the card example above, if q_i = 3, then the answer would be

Card 3 is a face up 4.

Examples

Example 1

Loading
Loading