Google is one of the most popular web search engines in the world. Many chinese like it very much and use it frequently. But recently, China Internet Illegal Information Reporting Centre(CIIRC) strongly criticized Google for "violating China's laws and regulations, contravening social morality and injuring public interest." At the same time, the Great Firewall blocked more and more world famous websites regardless of the complaints from internet users.
As worrying about that Google will also be blocked soon, you decide to eatablish your own web search engine named Googolplex((10)^(10^100)) and share it with other ACMers.
Unitl now the spider of your Googolplex has crawled so many web pages that the page will be too long to display all the search result in a single page. So it's time to develop the pagination function for Googolplex.
Pagination is used for displaying a limited number of results on search engine results pages. As many nicely designed websites, the format of page numbers of your pagination should follow the specification below:
1. As demonstrated in the picture, the format of the page numbers consists of 7 parts. They are, from left to right: first page, left ellipsis, previous mark, middle pages, next mark, right ellipsis, last page. The middle pages part contains the current page that the user is visiting now(it's "8" in the picutre). Please note that some of these parts will be hidden if the current page is some specific values.
2. For the first page part: It always displays "1". If the first page of middle pages part is equal to 1, this part should be hidden.
3. For the left ellipsis part: It always displays "...". If the first page of middle pages part is 2, or the first page part is hidden, this part should be hidden.
4. For the previous mark part: It always displays "<<". If the current page is 1, this part should be hidden.
5. For the middle pages part: It displays M numbers at most. If M is greater than T, the total number of pages, it displays T numbers. The position of the current page C should be M/2+1. So there are M/2 numbers before C and M-(M/2+1) after C. If the numbers before C is less than M/2, the middle pages part will shift to right to ensure there are M numbers displayed in total. If the numbers after C is less than M-(M/2+1), the middle pages part will shift to left to ensure there are M numbers displayed in total. Please refer to the sample for clarification.
6. For the next mark part: It always displays ">>". If the current page is equal to the last page, this part should be hidden.
7. For the right ellipsis part: It always displays "...". If the last page of middle pages part is one less than the total number of pages, or the last page part is hidden, this part should be hidden.
8. For the last page part: It always displays T, the total number of pages. If the last page of middle pages part is equal to T, this part should be hidden.
Given T, the total number of pages, M, the number of pages displayed in the middle pages part, and C, the current page that the user is visiting now, please write a program to generate the page numbers of pagination in the required format.