Under construction

Still being built. Things may change

I Thought of a Number

Interview

Time limit1sMemory limit1024 MB

Summary
Given a and b, find the starting number that becomes b after dividing by a, subtracting a, and repeating those two steps once more.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

One day Bobi told his brother Ivo: I thought of a number. Find it if you can. Divide it by a, subtract a from the result, and perform the same two steps again on the new number. The final result is b. Help Ivo by writing a program think that, given a and b, finds the number Bobi thought of.

Input

The input contains two integers a and b from standard input.

Output

Print the number Bobi thought of to standard output.

Constraints

1≤a≤1001 \le a \le 100

1≤b≤1001 \le b \le 100

Examples1

  1. Example 1

    Input
    7 33
    
    Expected output
    2009