main = getLine >>= print . kadomatsu . map read . words kadomatsu [a,b] | a < b = b - 2 | otherwise = 2000000000 - b - 1