Олимпиадный тренинг

Задача 38773. Cinema


Задача

Темы:
In the cinema, seats are often arranged with a shift in adjacent rows for the convenience of the audience. Let such a cinema have N seats in the 1st, 3rd, 5th and all odd rows and N + 1 seats in the 2nd, 4th and all even rows. Seats in rows are numbered from 1 to N in odd rows and from 1 to N + 1 in even rows. The box office sells tickets in a row: first in the 1st row for seats from 1st to Nth, then — to the 2nd row to places from 1st to N + 1st, then to the 3rd row from 1st place, etc. Determine the row number and seat number for the Kth sold ticket.

Input
The program receives two integers as input. The first line contains the number N (1 <= N <= 109 ) — number of seats in the 1st row of the cinema. The second line contains the number K — serial number of the sold ticket (1 <= K <= 2 × 109 ).

Imprint
The program should output two numbers on one line separated by a space: the number of the row and the number of the seat of the Kth sold ticket.
 
Examples
# Input Output Explanation
1 10
25
3 4 Tickets 1 to 10 will be sold to the front row. Tickets from 11 to 21 will be sold to the second row. Tickets will be sold in the third row, starting from the 22nd, the 25th ticket will be in the 4th place of the 3rd row.