local n = io.read('*n')
local a = io.read('*n')
local b = io.read('*n')
if b < a then
	print(0)
	return
end
if n == 1 then
	if a ~= b then
		print(0)
		return
	else
		print(1)
		return
	end
elseif n == 2 then
	print(1)
	return
end
print((n-2)*(b-a)+1)