The book thief

On February 18, 2014, Red Matemática proposed the following mathematical challenge on their twitter account (@redmatematicant): “While Anita read: The book thief by Markus Zusak, She added all the page numbers starting from 1. When she finished the book, she got a sum equal to 9.000 but she realized that one page number was forgotten in the process. What is such number? and, how many pages does the book have?” Using this interesting puzzle as our starting point, the problem you are asked to solve now is: Given a positive integer s (1 ≤ s ≤ 108) representing the result obtained by Anita, find out the number of the forgotten page and the total number of pages in the book. Input The input may contain several test cases. Each test case is presented on a single line, and contains one positive integer s. The input ends with a test case in which s is zero, and this case must not be processed. Output For each test case, your program must print two positive integers denoting the number of the forgotten page and the total number pages in the book. Each valid test case must generate just one output line. Sample Input 1 2 3 4 5 6 9000 499977 49999775 0 Sample Output 22 12 33 23 13 44 45 134 523 1000 5225 10000