qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
n=int(input())
s=list(input())

for i in range(n):
    if s[i]==')':
        s[i]=1
    else:
        s[i]=-1

ans=0
v=[]
for i in range(n):
    ans+=s[i]
    if ans>0:
        v.append(-1)
        ans-=1
s=v+s
if ans<0:
    for i in range(abs(ans)):
        s.append(1)
for i in range(len(s)):
    if s[i]==-1:
        s[i]='('
    else:
        s[i]=')'
print(*s)
            
            
            
    
        

        
    


# Fixed code:
n=int(input())
s=list(input())

for i in range(n):
    if s[i]==')':
        s[i]=1
    else:
        s[i]=-1

ans=0
v=[]
for i in range(n):
    ans+=s[i]
    if ans>0:
        v.append(-1)
        ans-=1
s=v+s
if ans<0:
    for i in range(abs(ans)):
        s.append(1)
for i in range(len(s)):
    if s[i]==-1:
        s[i]='('
    else:
        s[i]=')'
print(''.join(s))
# Buggy code:
from itertools import groupby
N = int(input())
S = input()
ans = []
#S1 = groupby(S)
a=0
a1=0
b=0
b1=0
S1 = groupby(list(S))
for key,group in S1:
  group = list(group)
  if list(key)==['(']:
    a=len(group)
    a1+=a
  else:
    b=len(group)
    b1+=b-a
    a1-=b
S = "("*b1+S
S = S+")"*a1
print("".join(S))

# Fixed code:
from itertools import groupby
N = int(input())
S = input()
ans = []
#S1 = groupby(S)
a=0
a1=0
b=0
b1=0
S1 = groupby(list(S))
for key,group in S1:
  group = list(group)
  if list(key)==['(']:
    a1+=len(group)
  else:
    if a1<=len(group):
      b1+=len(group)-a1
      a1 = 0
    else:
      a1 -=len(group)
S = S+")"*a1
S = "("*b1+S
print(S)
# Buggy code:
N = int(input())
S = input()

d = [0] * (N + 1)
for i in range(N):
    d[i + 1] = d[i] + int(S[i] == "(") - int(S[i] == ")")

a = d[-1]
b = min(d)

print("(" * -a + S + ")" * (b - a))



# Fixed code:
N = int(input())
S = input()

d = [0] * (N + 1)
for i in range(N):
    d[i + 1] = d[i] + int(S[i] == "(") - int(S[i] == ")")

a = d[-1]
b = min(d)

print("(" * -b + S + ")" * (a - b))
# Buggy code:
N = int(input())
S = input()
s = S[:]
while '()' in s:
    s.replace('()', '')
ans = '(' * s.count(')') + S + ')' * s.count('(')
print(ans)


# Fixed code:
N = int(input())
S = input()
s = S[:]
while '()' in s:
    s = s.replace('()', '')
ans = '(' * s.count(')') + S + ')' * s.count('(')
print(ans)
# Buggy code:
n=int(input())
s=input()
x=[]
y=0
for i in range(n):
    if s[i]=="(":
        x.append("(")
        y+=1
    elif y>0:
        x.append(")")
        y-=1
    else:
        x.append(")")
        x=["("]+x
print("".join(x))

# Fixed code:
n=int(input())
s=input()
x=[]
y=0
for i in range(n):
    if s[i]=="(":
        x.append("(")
        y+=1
    elif y>0:
        x.append(")")
        y-=1
    else:
        x.append(")")
        x=["("]+x
x=x+[")"]*y
print("".join(x))
# Buggy code:
N=int(input())
S=input()
stack= []
ans=""
L=0
R=0

for i in range(N):
  if S[i]=="(":
    stack.append(S[i])
  else:
    if len(stack)>0:
      stack.pop()
    else:
      R += 1

L=len(stack)
ans = L * "(" + ans + R * ")"

print(ans)

# Fixed code:
N=int(input())
S=input()
stack= []
ans=""
L=0
R=0

for i in range(N):
  if S[i]=="(":
    stack.append(S[i])
  else:
    if len(stack)>0:
      stack.pop()
    else:
      L += 1

R=len(stack)
ans = L * "(" + S + R * ")"

print(ans)
# Buggy code:
N = int(input())
S = input()
diff = [0] * (N + 1)
for i in range(N):
    if S[i] == "(":
        diff[i + 1] = diff[i] + 1
    else:
        diff[i + 1] = diff[i] - 1
min_diff = min(diff)
print("(" * min_diff + S + ")" * (diff[N] - min_diff))


# Fixed code:
N = int(input())
S = input()
diff = [0] * (N + 1)
for i in range(N):
    if S[i] == "(":
        diff[i + 1] = diff[i] + 1
    else:
        diff[i + 1] = diff[i] - 1
min_diff = min(diff)
print("(" * -min_diff + S + ")" * (diff[N] - min_diff))
# Buggy code:
input()
s=t=input()
l,r=o="()"
exec('s=s'+'.replace(o,"")'*50)
print(l*(c:=s.count)(l)+t+r*c(r))

# Fixed code:
input()
s=t=input()
l,r=o="()"
exec('s=s'+'.replace(o,"")'*50)
print(l*(c:=s.count)(r)+t+r*c(l))
# Buggy code:
N=int(input())
S=input()
sl=list(S)
change=[0]
for i in range(1,N):
  if (sl[i-1]==')')and(sl[i]=='('):
    change.append(i)

change.append(N)
r_add=0
l_add=0
for i in range(len(change)-1):
  A=sl[change[i]:change[i+1]]
  r=0
  l=0
  for a in A:
    if a=='(':
      l+=1
    else:
      r+=1
      
  if r==l:
    continue
  elif r>l:
    l_add+=r-l
    r_add-=r-l
  else:
    r_add+=l-r
    l_add-=l-r
      
print('('*l_add+S+')'*r_add)

# Fixed code:
N=int(input())
S=input()
sl=list(S)
change=[0]
for i in range(1,N):
  if (sl[i-1]==')')and(sl[i]=='('):
    change.append(i)

change.append(N)
r_add=0
l_add=0
for i in range(len(change)-1):
  A=sl[change[i]:change[i+1]]
  r=0
  l=0
  for a in A:
    if a=='(':
      l+=1
    else:
      r+=1
      
  if r==l:
    continue
  elif r>l:
    if r_add>0:
      if r_add>=r-l:
        r_add-=r-l
      else:
        l_add+=r-l-r_add
        r_add=0
        
    else:
      l_add+=r-l
      
  else:
    r_add+=l-r
      
print('('*l_add+S+')'*r_add)
# Buggy code:
def main():
    n = int(input())
    s = list(input())
    left = 0
    right = 0
    for i in range(n):
        if s[i] == '(':
            right += 1
        else:
            if right == 0:
                left += 1
            else:
                right -= 1
    res = ''
    print('('*left+s+')'*right)

if __name__ == '__main__':
    main()


# Fixed code:
def main():
    n = int(input())
    s = input()
    left = 0
    right = 0
    for i in range(n):
        if s[i] == '(':
            right += 1
        else:
            if right == 0:
                left += 1
            else:
                right -= 1
    print('('*left+s+')'*right)

if __name__ == '__main__':
    main()
# Buggy code:
a,b=int(x) for x in input().split(' ')
print("error" if a+b>=10 else a+b)

# Fixed code:
a,b=(int(x) for x in input().split())
if a+b>=10:
    print("error")
else:
    print(a+b)
# Buggy code:
a,b = map(int,input().split())

print(a+b if a+b < 10 else error)

# Fixed code:
a,b = map(int,input().split())

print(a+b if a+b < 10 else 'error')
# Buggy code:
a, b = map(int, input().split())
if a + b >10:
  print('error')
else:
  print(a+b)

# Fixed code:
a,b=map(int,input().split())
if a+b>=10:
  print("error")
else:
  print(a+b)
# Buggy code:
A, B = [int(i) for i in input().split()]

if A+B > 9:
	print('error')
	return
print(A+B)

# Fixed code:
def print_add():
	A, B = [int(i) for i in input().split()]

	if A+B > 9:
		print('error')
		return 
	print(A+B)
	return
	
print_add()
# Buggy code:
a,b=(int(i) for i in input().split())
if a+b>+10:
    print('error')
else:
    print(a+b)

# Fixed code:
a,b=(int(i) for i in input().split())
if a+b>=10:
    print('error')
else:
    print(a+b)
# Buggy code:
a, b = map(int, input().spkit())
ans = "error" if(a + b >= 10) else a + b
print(ans)


# Fixed code:
a, b = map(int, input().split())
ans = "error" if(a + b >= 10) else a + b
print(ans)
# Buggy code:
A,B = map(int,input().split())
if A+B<=10:
    print("error")
else:
    print(A+B)

# Fixed code:
A, B = map(int, input().split())
if A + B >= 10:
    print('error')
else:
    print(A + B)
# Buggy code:
a,b = map(int,input().split())
n = a + b
if n >= 10:
    print('error')
else:
    print('n')

# Fixed code:
a,b = list(map(int, input().split()))
if a + b >= 10:
    print("error")
else:
    print(a + b)
# Buggy code:
A, B = map(int, input().split())

if A + B < 10: print(C)
else: print('error')

# Fixed code:
A, B = map(int, input().split())
if 10 <= (A+B):
    print('error')
else:
    print(A+B)
# Buggy code:
import sys
input = sys.stdin.readline
A, B = [int(x) for x in inpput().split()]
if A + B >= 10:
    print("error")
else:
    print(A + B)

# Fixed code:
import sys
input = sys.stdin.readline
A, B = [int(x) for x in input().split()]
if A + B >= 10:
    print("error")
else:
    print(A + B)
# Buggy code:
S,A,B = map(int, input().split())
S=A+B
if S>=10:
	print('error')
else:
	print(S)



# Fixed code:
A, B = map(int, input().split())
if A+B >= 10: print('error')
else: print(A+B)
# Buggy code:
a, b = map(int,input().split())

if( (a+b) >= 10):
    print("error")
else:
    print(A+B)

# Fixed code:
a, b = map(int,input().split())

if( (a+b) >= 10):
    print("error")
else:
    print(a+b)
# Buggy code:
A,B = map(int,input().split())  
if A + B < 10:
  prin(A+B)
else:
  print('error')

# Fixed code:
A, B = map(int, input().split())
if A + B < 10:
  print(A+B)
else:
  print("error")
# Buggy code:
#!/usr/bin/env python3

def main():
    a, b = map(int, input().split())
    print(a + b if a + b < 10 else 'errpr')


if __name__ == "__main__":
    main()


# Fixed code:
#!/usr/bin/env python3

def main():
    a, b = map(int, input().split())
    print(a + b if a + b < 10 else 'error')


if __name__ == "__main__":
    main()
# Buggy code:
[a,b] = [int(x) for x in input().split()]
if a+b < 10:
  print(a+b)
else:
  print("None")
  

# Fixed code:
[a,b] = [int(x) for x in input().split()]
if a+b < 10:
  print(a+b)
else:
  print("error")
# Buggy code:
A, B = map(int,input().split())
if(A+B > 10):
  print("error")
else:
  print(A+B)

# Fixed code:
A, B = map(int,input().split())

if(A+B < 10):
  print(A+B)
else:
  print("error")
# Buggy code:
a,b = map(int,input().split())
if a+b >= 10:
  print('error')
else:
  print('a+b')

# Fixed code:
a,b=map(int,input().split())
if a+b >=10:print("error")
else:print(a+b)
# Buggy code:
a,b=map(int,input().split())
if a+b>=10:
  print('error')
else:
  print('a+b')

# Fixed code:
a,b = map(int,input().split())
s = a+b
print('error') if s>=10 else print(s)
# Buggy code:
a,b = map(int(input().split()))
if a+b >= 10:
  print("error")
else:
  print(a+b)

# Fixed code:
a,b=map(int,input().split())
if a+b>=10:
     print("error")
else:
     print(a+b)
# Buggy code:
a,b = map(int, input().split())

if a + b < 10:
  print('Yes')
else:
  print('error')

# Fixed code:

a, b = list(map(int, input().split()))

if a + b < 10:
	print(a + b)
else:
	print('error')
# Buggy code:
a, b = map(int, input().split())
print('error' if a + b > 10 else a + b)

# Fixed code:
a,b = map(int,input().split())
print("error" if a+b>=10 else a+b)
# Buggy code:
a,b = map(int,input().split())
if a+b > 10:
  print('error')
else:
  print(a+b)

# Fixed code:
a, b = map(int, input().split())
if a+b>=10:
    print('error')
else:
    print(a+b)
# Buggy code:
A,B = map(int, input().split())

A_B = (A+B)

if A <= 10:
    print(A_B)
else:
    print("error")

# Fixed code:
A,B=map(int, input().split())

if A+B<10:
  print(A+B)
else:
  print("error")
# Buggy code:
a, b = map(int, input().split())
print("error" if a+b>10 else a+b)

# Fixed code:
a,b = map(int, input().split())
if (a+b>=10):
	print("error")
else:
	print(a+b)
# Buggy code:
A,B=map(int,input().split())
if A+B<10:
    print(A+B)
else:
    print("erorr")

# Fixed code:
A,B=map(int,input().split())
if A+B<10:
    print(A+B)
else:
    print("error")
# Buggy code:
x,y = map(int,input().split())
if x+y >= 10:
  print(x+y)
else:
  print('error')

# Fixed code:
x,y = map(int,input().split())
if x+y >= 10:
  print('error')
else:
  print(x+y)
# Buggy code:
A,B=map(int,input().split())
print(A+B if A+B>10 else 'error')

# Fixed code:
A,B = map(int,input().split())
if A + B >= 10:
    print("error")
else:
    print(A + B)
# Buggy code:
A, B = map(int, input().split())

print(["error", A + B] A + B < 10)


# Fixed code:
A, B = map(int, input().split())

print(["error", A + B] [A + B < 10])
# Buggy code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

a = int(input())
b = int(input())

if a+b >= 10:
    print("error")
else:
    print(a+b)



# Fixed code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

a,b =  map(int,input().split())

if a+b >= 10:
    print("error")
else:
    print(a+b)
# Buggy code:
a,b=map(int,input().split())
print(a+b if(a+b)<=10 else 'error')

# Fixed code:
a,b = map(int, input().split())
print(a+b) if a+b <10 else print('error')
# Buggy code:
N, A, B = [int(i) for i in input().split()]
res = max(0, (N-2) * B - (N-2) * B + 1)
print(res)

# Fixed code:
N, A, B = [int(i) for i in input().split()]
res = max(0, (N-2) * B - (N-2) * A + 1)
print(res)
# Buggy code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, a, b = LI()
    print(b * n + a - b - (a * b - a + b - 1))
    return


#main
if __name__ == '__main__':
    solve()


# Fixed code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, a, b = LI()
    print(max(b * n + a - b - (a * n - a + b - 1),0))
    return


#main
if __name__ == '__main__':
    solve()
# Buggy code:
N, A, B = map(int, input().split())
print(max(0, B*(N-1)+A-(A*(N-1)+B)))


# Fixed code:
N,A,B = map(int,input().split())
print(max((B * (N- 1) + A) - (A * (N- 1) + B) + 1,0))
# Buggy code:
n,a,b=map(int, input().split())
ans=(n-2)*(b-a)*2+1
if n==1:
    if a!=b:
        ans=0
    else:
        ans=1
if b<a:ans=0
print(ans)

# Fixed code:
n, a, b = map(int, input().split())
ans = ((b - a) * (n - 2)) + 1
if ans < 0:
    ans = 0
print(ans)
# Buggy code:
n,a,b = map(int,input().split())
print(max(0, (b-a+1)+(b-a)))


# Fixed code:
n, a, b = map(int, input().split())
print(max((b*(n-1)+a)-(a*(n-1)+b)+1, 0))
# Buggy code:
n, a, b = map(int, input().split())
if (a < b) print(0)
else print(b*(n-1)+a-a*(n-1)-b+1)


# Fixed code:
n, a, b = map(int, input().split())
result = (b * (n - 1) + a) - (a * (n - 1) + b) + 1
print(0 if result < 0 else result)
# Buggy code:
n, a, b = map(int , input().split())
if a > b or n < 2:
    print(0)
elif a == b or (n == 1 and a == b):
    print(1)
else:
    print((b * (n-1) + a) - (a * (n-1) + b) + 1)

# Fixed code:
n,a,b=map(int,input().split())
if a>b or n==1 and a!=b:print(0)
elif n<3:print(1)
else:print((b-a)*(n-2)+1)
# Buggy code:
N, A, B = map(int, input().split())

if A > B:
  print(0)
  exit()

if A == B:
  if N == 1:
    print(1)
    exit()
  else:
    print(0)
    exit()

print((N-2)*(B-A)+1)

# Fixed code:
# AGC015
N, A, B = map(int, input().split())
if A > B:
    print(0)
    exit()
if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    exit()
print((B - A ) * (N - 2) + 1)
# Buggy code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n,a,b = LI()
    if n == 1:
        if a == b:
            return 1
        return 0

    if a > b:
        return 0

    return min((b*(n-1)+a) - (a*(n-1)+b) + 1, n)


print(main())


# Fixed code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n,a,b = LI()
    if n == 1:
        if a == b:
            return 1
        return 0

    if a > b:
        return 0

    if n == 2:
        return 1

    return (b*(n-1)+a) - (a*(n-1)+b) + 1


print(main())
# Buggy code:
n, a, b = map(int, input().split())

if n == 1:
  if a != b:
    print(0)
  else:
    print(1)
elif n == 2:
  print(1)
else:
  if a == b:
    print(1)
  else:
    print((b-a) * (n-2) + 1)

# Fixed code:
n, a, b = map(int, input().split())
if a > b:
    print(0)
    exit(0)
if a == b:
    print(1)
    exit(0)
if n == 1:
    if a != b:
        print(0)
    else:
        print(1)
elif n == 2:
    print(1)
else:
    print(b * (n - 2) - a * (n - 2) + 1)
# Buggy code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, a, b = ns()

    if n == 2:
        print(1)
        exit(0)

    if a > b or n < 2:
        print(0)
        exit(0)

    minimum_sum = a * n + (b - a)
    maximum_sum = a * n - (b - a)
    print(maximum_sum - minimum_sum + 1)


if __name__ == '__main__':
    main()


# Fixed code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, a, b = ns()

    if n == 2:
        print(1)
        exit(0)

    if a > b:
        print(0)
        exit(0)

    if n==1:
        if a==b:
            print(1)
            exit(0)
        else:
            print(0)
            exit(0)

    minimum_sum = a * n + (b - a)
    maximum_sum = b * n - (b - a)
    print(maximum_sum - minimum_sum + 1)


if __name__ == '__main__':
    main()
# Buggy code:

N, A, B = map(int, input().split())
if A > B:
    print(0)
else:
    print((B - A) * (N - 2) + 1)

# Fixed code:
N,A,B=map(int,input().split())

tmp=(N-2)*(B-A)+1
if tmp>0:
    print(tmp)
else:
    print(0)
# Buggy code:
length,min_num,max_num = (int(n) for n in input().split(" "))
if min_num > max_num or length == 1:
    print(0)
elif min_num == max_num:
    print(1)
else:
    max_max = max_num * (length - 1) + min_num
    min_min = min_num * (length - 1) + max_num
    print(max_max - min_min + 1)

# Fixed code:
length,min_num,max_num = (int(n) for n in input().split(" "))
if min_num > max_num or (length == 1 and min_num != max_num):
    print(0)
elif min_num == max_num or length == 2:
    print(1)
else:
    max_max = max_num * (length - 1) + min_num
    min_min = min_num * (length - 1) + max_num
    print(max_max - min_min + 1)
# Buggy code:
n, a, b = map(int, input().split())
ans = 0
if n != 0 and a == b:
    ans = 1
elif n!=0 and b>a:
    ans = 1+(b-a)*(n-2)
print(ans)

# Fixed code:
n,a,b = map(int,input().split())

if(a>b):
    ans=0
elif(a==b and n==1):
    ans=1
elif(a==b and n!=1):
    ans=1
elif(a<b and n==1):
    ans=0
elif(a<b and n==2):
    ans=1
else:
    ans=(2-n)*(a-b)+1
print(ans)
# Buggy code:
n,a,b = list(map(int, input().split()))
if n == 1:
    print(0)
elif a>b:
    print(0)
else:
    MIN = a * (n-1) + b
    MAX = a * 1 + b * (n-1)
    print(MAX-MIN+1)

# Fixed code:
n,a,b = list(map(int, input().split()))
if n == 1:
    if a==b:
        print(1)
    else:
        print(0)
elif a>b:
    print(0)
else:
    MIN = a * (n-1) + b
    MAX = a * 1 + b * (n-1)
    print(MAX-MIN+1)
# Buggy code:
n,a,b=map(int,input().split())
if a==b:
    if n==1:
        print(1)
    else:
        print(0)
elif b-a<0:
    print(0)
else:
    print( a+b*(n-1) - (a*(n-1)+b) +1 )

# Fixed code:
n, a, b = map(int, input().split())

if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
else:
    if a < b:
        low = a * (n - 1) + b
        high = a + b * (n - 1)
        print(high - low + 1)
    elif a == b:
        print(1)
    else:
        print(0)
# Buggy code:
S = list(map(int, input().split()))
N = S[0]
A = S[1]
B = S[2]
combi = 0
if(A > B or N == 1):
    print(0)
else:
    cand = N - 2
    combi = (cand * B) - (cand * A) + 1
    print(combi)


# Fixed code:
S = list(map(int, input().split()))
N = S[0]
A = S[1]
B = S[2]
combi = 0
if(A > B):
    print(0)
elif(N == 1):
    combi = 1 if (A == B) else 0
    print(combi)
else:
    cand = N - 2
    combi = (cand * B) - (cand * A) + 1
    print(combi)
# Buggy code:
tmp = list(map(int,input().split()))
n , a, b = tmp[0],tmp[1],tmp[2]
if (n ==2):
  print(1)
elif (n == 1):
  if a != b:
    print(0)
  else:
    print(1)
else:
  print((b-a) * (n-2) + 1)

# Fixed code:
tmp = list(map(int,input().split()))
n , a, b = tmp[0],tmp[1],tmp[2]
if a>b:
 print(0)
 quit()
if (n ==2):
  print(1)
elif (n == 1):
  if a != b:
    print(0)
  else:
    print(1)
else:
  print((b-a) * (n-2) + 1)
# Buggy code:
N, A, B = map(int, input().split())

if A > B :
    ans = 0
elif A == B :
    ans = 1
else:
    ans = (B*(N-1)+A) - (A*(N-1)+B) + 1

print(ans)

# Fixed code:
N, A, B = map(int, input().split())
ans = (B * (N - 1) + A) - (B + A * (N - 1)) + 1
print(ans) if(ans > 0) else print(0)
# Buggy code:
n,a,b=map(int,input().split())
if a>b:print(0)
elif n==1 and a!=b:print(0)
else:print((n-2)*(b-a)+1)​

# Fixed code:
n, a, b = map(int, input().split())
if a > b:
    print(0)
elif n == 1:
    if a != b:
        print(0)
    else:
        print(1)
else:
    print((n - 2) * (b - a) + 1)
# Buggy code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def FI(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline().split())
def S(): return input()

n, a, b = LI()

if a>b:
	print(0)
else:
	mi = a*(n-1)+b
	ma = a+b*(n-1)
	print(ma-mi+1)

# Fixed code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def FI(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline().split())
def S(): return input()

n, a, b = LI()

if a>b:
	print(0)
elif n==1 and a!=b:
	print(0)
else:
	mi = a*(n-1)+b
	ma = a+b*(n-1)
	print(ma-mi+1)
# Buggy code:
[n,a,b] = [int(i) for i in input().split()]
c = 1
if a > b:
    c = 0
if n == 1 and a != b:
    c = -1

if c == 1:
    print(b * (n-1) + a - (a * (n-1) + b) + 1)


# Fixed code:
n, a, b = [int(i) for i in input().split()]
if a > b:
    print(0)
elif a != b and n == 1:
    print(0)
else:
    c = a * (n - 1) + b
    d = a + b * (n - 1)
    print(d-c+1)