For those who believe that in the good old days — before calculators, before computers — people were better at mental arithmetic, The New York Times offers a sobering New Year's message: not necessarily.

On February 6, 1898, a worker preparing the front page of The New York Times added 1 to that day's issue number in the upper left corner (14,499) and got 15,000.

New York Times

Amazingly, no one caught the error because the 500-issue error persisted until 1999. So on January 1, 2000, the paper turned back the clock, reverting from 51,753 to 51,254. Thus an article on March 14, 1995, celebrating the arrival of No. 50,000 was 500 days premature. It should have appeared on July 26, 1996.

The error came to light in 1999 when 24-year-old news assistant Aaron Donovan started wondering about the history of the issue numbering, which he had to update overnight while working at The New York Times news desk. He wondered whether errors might have crept into the numbering. Using a spreadsheet program, he listed the dates of publication of the newspaper since its founding on September 18, 1851. As a result, he noticed that the serial number of the current editions was actually 500 too high.

Through the newspaper's archives, he learned that in its first 500 weeks, The New York Times published no Sunday issue. Then, for 2,296 weeks from April 1861 to April 1905, the Sunday issue was treated as an extension of the Saturday paper, bearing its number. In the early days, the paper skipped publication on a few holidays. No issues were published for 88 days during a strike in 1978. During five earlier labor disputes, unpublished issues were assigned numbers, sometimes because catch-up editions were later produced for the archives.

Finally, by scanning books of historic front pages and reels of microfilm, Mr. Donovan zeroed in on the date of the 500-issue gap. In a memo, he wrote:

There is something that appeals to me about the way the issue number marks the passage of time across decades and centuries. It has been steadily climbing for longer than anyone who has ever glanced at it has been alive. The 19th-century newsboy hawking papers in a snowy Union Square is in some minute way bound by the issue number to the Seattle advertising executive reading the paper with her feet propped up on the desk.

As for the other number on the front page — the volume, in Roman numerals — it remained CXLIX on January 1, 2000 but changed to CL on Sept. 18, 2000, when The New York Times entered its 150th year.

Input

The first line contains an integer $$i$$ that is called the increment. This is followed by zero or more integers, each on a separate line. The sequence of numbers is closed with a line containing the text NYT.

Output

We assume that each subsequent number in the sequence results from adding the increment to the previous number in the sequence. For each number in the sequence where this conditions does not apply, a line must be printed in the format

previous -> current (difference)

The fragments in italic must be replaced respectively by the previous number in the sequence, the current number in the sequence and the difference between the current and the previous number. The difference should always be preceded by either a plus or a minus sign (and we write +0, not -0). Note that the sequence of numbers may contain zero or more mistakes.

Example

Input:

1
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
NYT

Output:

14499 -> 15000 (+501)