import Data.Int (Int64)

solve :: Integral a => a -> a -> a -> a
solve n a b
    | a > b = 0
    | n == 1 = if a == b then 1 else 0
    | n == 2 = 1
    | n >= 3 = if a == b then 1 else (b - a) * (n - 2) + 1
    | otherwise = 0

main :: IO ()
main = do
    [n, a, b] <- fmap read . words <$> getLine :: IO [Int64]
    print $ solve n a b
