TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Some day in the future a person named Reuben wants to submit some interesting problems to the judging director of ACM ICPC (Association for Copotron Mechanics International Collegiate Programming Contest) World Finals so that they can be used in World Finals 2031. This contest requires problem submitters to submit their problems in encrypted format. But in year 2030, encryption software is not widely available on the Internet just to prevent terrorists from sending encrypted messages. So he wants to use a simplified encryption technique to submit his problem. He uses several 12-digit encryption keys to encrypt his messages. We would not disclose the encryption/decryption technique for safety because your next generations will be competing in World Finals by then. But Reuben also does not want to send his encryption key in a straightforward email. He wants to send a key (public) K1 that will implicitly denote the actual key (private) K2. K2 is such a 12 digit number so that K1K2 = K2 (modulo 1012). Given the value of K1 your job is to help Reuben find the value of K2.
Warn: 本題有 specialjudge

Input Format

The input file contains around 1600 line of input. Each line contains an integer, which denotes the value of K1 (0 < K1 < 50001). A line containing a single zero terminates input.

Output Format

For each line of input produce one line of output. This line contains the serial of output, followed by the given public key K1 and then a possible actual private key K2. Look at the output for sample input for exact formatting. Inputs will be such that for given value of K1 there will always be at least one value of K2. Note that K2 should always have 12 digits and will not have any leading zeroes.

Sample Input 1

78
99
0

Sample Output 1

Case 1: Public Key = 78 Private Key = 308646916096
Case 2: Public Key = 99 Private Key = 817245479899
 

Hints

Problem Source

Migrated from old NTUJ.

Regional Kuala Lumpur 2010

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 2000 65536 200