## Problem Description

Now let us take an abnormal physical and mental exercise on the steps.
Assume that the building has infinite steps. And there are only two methods to run on the steps: go up A steps, or, go down B steps. Every time you can choose any of the two methods, but you should not go up with less than A steps or go down with less than B steps.
You start from the ground, during the exercise, you should reach the Nth step but not exceed the Nth step and come back to the ground.
Before you start to run, you are given two number A and B to determine the smallest N so that you can achieve this goal.
## Input

The input consists of several test cases. Each case contains a line with two positive numbers A and B.(1 <= A, B <= 500)

## Output

The smallest N to achieve this goal.

## Sample Input

5 3
1 1
6 4

## Sample Output

7
1
8

## Source

FZU 2009 Summer Training Qualification -- Hero Revival 1