R=range A,B=map(int,input().split()) print(sum(x**3-x*x+x+1for x in R(max(2,A),B+1)if all(x%i for i in R(2,x))))