let f a b = if a < b then b - 1 + 1 - 2 else 2000000000 - b + 1 - 2 let A,B = let t = stdin.ReadLine().Split() |> Array.map int t.[0], t.[1] f A B |> stdout.WriteLine