PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000014. Số thứ k không chia hết cho n (K-th Not Divisible by n)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

2 lộ trình

Số thứ k không chia hết cho n (K-th Not Divisible by n)

K-th Not Divisible by n

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers nn and kk, consider all positive integers not divisible by nn, in increasing order. Find the kk-th number in this sequence.

Input

One line contains nn and kk.

Output

Print the kk-th positive integer not divisible by nn.

Subtasks

  • Subtask 1 (20 points): 2≤n≤1032\le n\le 10^3; 1≤k≤1031\le k\le 10^3.
  • Subtask 2 (30 points): 2≤n≤1062\le n\le 10^6; 1≤k≤1061\le k\le 10^6.
  • Subtask 3 (50 points): 2≤n≤1092\le n\le 10^9; 1≤k≤1091\le k\le 10^9.

Examples

Input

3 7

Output

10

Explanation

The sequence is 1,2,4,5,7,8,10,…1,2,4,5,7,8,10,\ldots, so the seventh element is 1010.