English-Number Translator In this problem, you will be given one or more integers in English. Your task is to translate these numbers into their integer representation. The numbers can range from negative 999,999,999 to positive 999,999,999. The following is an exhaustive list of English words that your program must account for: negative, zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, million Input and Output Notes on input: 1. Negative numbers will be preceded by the word negative. 2. The word ``hundred'' is not used when ``thousand'' could be. For example, 1500 is written ``one thousand five hundred'', not ``fifteen hundred''. 3. The words ``hundred,'' ``thousand,'' and ``million'' are always immediately preceded by a word indicating the numbers one through nine, inclusive. The answers are expected to be on separate lines with a newline after each. Sample Input six negative seven hundred twenty nine one million one hundred one Crosswords A crossword can be stored as a matrix of zeros and ones. Zero represents white squares and one represents black squares. Some squares of the crossword are numbered and assigned to these numbers are the descriptions of the words that should be written either ``across'' or ``down'' into the crossword. A square is numbered if it is a white square and either (a) the square below it is white and there is no white square immediately above, or (b) there is no white square immediately to its left and the square to its right is white. The squares are numbered from left to right, from the top line to the bottom line. From the matrix a crossword diagram can be drawn. In the diagram each square is represented by a box characters. Black square and white squares (numbered and not numbered square) are represented as follows (where nnn is the number of the square): The remaining characters of the box are spaces. If black squares are given at the edges, they should be removed from the diagram (see the example). Only use spaces as necessary filling characters. Don't use any unnecessary spaces at the end of the line. Input The input file consists of several blocks of lines each representing a crossword. Each block starts with the line containing two integers m < 25 and n < 25 separated by one space. In each of the next m lines there are n numbers 0 or 1, separated by one space. The last block will be empty, m = n = 0. Output The output file contains the corresponding crossword diagram for each except the last block. After each diagram there are two empty lines, with a "cut here line" (50 '-' characters) in between. Sample Input Pseudo-Random Numbers Computers normally cannot generate really random numbers, but frequently are used to generate sequences of pseudo-random numbers. These are generated by some algorithm, but appear for all practical purposes to be really random. Random numbers are used in many applications, including simulation. A common pseudo-random number generation technique is called the linear congruential method. If the last pseudo-random number generated was L, then the next number is generated by evaluating ( , where Z is a constant multiplier, I is a constant increment, and M is a constant modulus. For example, suppose Z is 7, I is 5, and M is 12. If the first random number (usually called the seed) is 4, then we can determine the next few pseudo-random numbers are follows: As you can see, the sequence of pseudo-random numbers generated by this technique repeats after six numbers. It should be clear that the longest sequence that can be generated using this technique is limited by the modulus, M. In this problem you will be given sets of values for Z, I, M, and the seed, L. Each of these will have no more than four digits. For each such set of values you are to determine the length of the cycle of pseudo-random numbers that will be generated. But be careful: the cycle might not begin with the seed! Input Each input line will contain four integer values, in order, for Z, I, M, and L. The last line will contain four zeroes, and marks the end of the input data. L will be less than M. Output For each input line, display the case number (they are sequentially numbered, starting with 1) and the length of the sequence of pseudo-random numbers before the sequence is repeated. Sample Input 7 5 12 4 5173 3849 3279 1511 9111 5309 6000 1234 1079 2136 9999 1237 0 0 0 0 Sample Output Case 1: 6 Case 2: 546 Case 3: 500 Case 4: 220 Queue There is a queue with N people. Every person has a different heigth. We can see P people, when we are looking from the beginning, and R people, when we are looking from the end.It's because they are having different height and they are covering each other. How many different permutations of our queue has such a interesting feature? Input Specification The input consists of T test cases. The number of them (1<=T<=10000) is given on the first line of the input file. Each test case begins with a line containing a single integer number Nthat indicates the number of people in a queue (1 <= N <= 13). Then follows line containing two integers. The first integer corresponds to the number of people, that we can see looking from the beginning. The second integer corresponds to the number of people, that we can see looking from the end. Output Specification For every test case your program has to determine one integer. Print how many permutations of N people we can see exactly P people from the beginning, and R people, when we are looking from the end.