Problems

# Dragon

# Dragon

Every `S`

-leg have 1 head. Find the quantity of legs `N`

in `K`

-head dragon, if they have `A`

head and `B`

legs together.

#### Input

4 numbers: `S`

, `K`

, `A`

, `B`

. Every numbers is <= 1000.

#### Output

The quantity of legs of dragon. If input data is contradiction, then output in file `-1`

, if you have some ways of solution – find free from it.

Input example #1

4 7 35 36

Output example #1

2