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