d782: 11490 - Just Another Problem
Tags :
Accepted rate : 25人/26人 ( 96% ) [非即時]

Content There is a wise saying “Nothing is unfair in love and war”. Probably that is why emperors of ancient days used to use many funny and clever tricks to fool the opponents. The most common technique was to scare the opponent away by out numbering them with imaginary soldiers. One of the funnier tricks (though hard to believe) was to give the own soldiers (not the opponent soldiers!) mild laxative dose so that there is a long queue of soldiers in front of toilet. Seeing this queue from a distance the opponent would miscalculate the total number of soldiers and flee away. This was a famous trick given by famous clown of the sub-continent named Gopal (The infamous “Gopal Bhar” to be precise). Another most common trick was to have square shaped holes while arranging the soldiers in rows and columns. Such an arrangement is shown below with 96 soldiers. Fig: A valid layout with 96 soldiers. After arranging them 8 soldiers are missing.

The strict property of such arrangement for this problem is as follows:

(a)    The soldiers have to be arranged in rows and columns.

(b)   The border of the arrangement has to be rectangular.

(c)    The arrangement should have soldiers missing only from the inner layers.

(d)   The soldiers should be missing only from two equal square shaped regions. So the number of missing soldiers should be twice of a strictly positive square number. In the figure above the number of missing soldier is 2*22.

(e)    The thickness of soldiers should be equal every where (except the corners) in horizontal and vertical directions along the missing square. For example in the figure above the thickness of soldiers in horizontal and vertical directions along the missing square is always three.

Now given the total number of soldiers S your job is to determine whether or not they can be arranged according to the above mentioned rules.

Input

The input file contains 1000 lines of inputs. Each line contains a positive integer S (S<1000000000000), where S is the total number of soldiers.

Input is terminated by line containing a single zero.

Output

For each line of input produce one or more line of output. Each line reports one possible number of possible missing soldiers which would enable the desired arrange with the S soldiers. As the number of possible missing soldiers can be quite large so instead of the actual number, the modulo 100000007 value should be printed. Also if there is more than one possible value for number of missing soldiers the modulo 100000007 values should be reported in descending order of the original number of soldier (Not the modulo value). If no such number of missing soldiers is found print the line “No Solution Possible” instead.

Print a blank line after the output for each line of input. Look at the output for sample input for details.

Sample Input #1
96
102
11100
0
Sample Output #1
Possible Missing Soldiers = 8

No Solution Possible

Possible Missing Soldiers = 553352
Possible Missing Soldiers = 308898
Possible Missing Soldiers = 45000
Possible Missing Soldiers = 3528


Hint ：
Tags:

[管理者：
(PCSHIC)
]

 ID User Problem Subject Hit Post Date 沒有發現任何「解題報告」
{"ft_lang_label":"__label__en","ft_lang_prob":0.9014389,"math_prob":0.9496129,"size":3045,"snap":"2021-04-2021-17","text_gpt3_token_len":638,"char_repetition_ratio":0.17527129,"word_repetition_ratio":0.02330097,"special_character_ratio":0.22101806,"punctuation_ratio":0.061705988,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9727283,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-16T06:59:01Z\",\"WARC-Record-ID\":\"<urn:uuid:8c38a5be-0bed-48fb-b5a9-fd93e1ebcb61>\",\"Content-Length\":\"42284\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:38cdb71c-dc0d-4e72-a27c-fa9aea1ed73b>\",\"WARC-Concurrent-To\":\"<urn:uuid:cd348dcf-0ee9-40de-a667-f9b7e282507b>\",\"WARC-IP-Address\":\"163.32.92.12\",\"WARC-Target-URI\":\"https://zerojudge.tw/ShowProblem?problemid=d782\",\"WARC-Payload-Digest\":\"sha1:2S6QWXTEEWTTXWQ6NTDEELXEH55VMZOC\",\"WARC-Block-Digest\":\"sha1:NZXBPQEUMLJH6GXSAVKQF2RIFP2RCDCL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618038088731.42_warc_CC-MAIN-20210416065116-20210416095116-00138.warc.gz\"}"}