406066: GYM102253 K KazaQ's Socks

Memory Limit:128 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. KazaQ's Sockstime limit per test1 secondmemory limit per test128 megabytesinputstandard inputoutputstandard output

KazaQ wears socks every day.

Before the first day, he has $$$n$$$ pairs of socks in his closet, labeled from $$$1$$$ to $$$n$$$.

Every morning, he would put on a pair of socks with the smallest label in the closet.

Every evening, he would take off socks and put them into a basket. After that, if there are $$$(n - 1)$$$ pairs of old socks in the basket, lazy KazaQ will have to wash them. These socks can be dried out on the next day and then will be put back to the closet in the evening.

KazaQ would like to know which pair of socks he would wear on the $$$k$$$-th day.

Input

The input contains multiple (about $$$2000$$$) test cases.

Each test case in only one line contains two integers $$$n$$$, $$$k$$$ ($$$2 \leq n \leq 10^9$$$, $$$1 \leq k \leq 10^{18}$$$).

Output

For each test case, output "Case #x: y" in one line (without quotes), where $$$x$$$ indicates the case number starting from $$$1$$$, and $$$y$$$ denotes the answer to the corresponding case.

ExampleInput
3 7
3 6
4 9
Output
Case #1: 3
Case #2: 1
Case #3: 2

加入题单

上一题 下一题 算法标签: