main :: IO ()
main = do
  param <- reads2List :: IO [Int]
  let n = head param
  let a = param !! 1
  let b = last param
  print $ solve n a b

s2List :: Read a => String -> [a]
s2List = fmap read . words

reads2List :: Read a => IO [a]
reads2List = do
  s <- getLine
  return (s2List s)

solve :: Int -> Int -> Int -> Int
solve 1 a b = if a == b then 1 else 0
solve n a b | a > b = 0
            | otherwise = (sum maxi - sum mini) + 1 where
              mini = b : replicate (n - 1) a
              maxi = a : replicate (n - 1) b
