l,r=map(int,input().split())
list1=[]
for i in range(l,r+1):
    for j in range(2,i):
        if i%j==0:
            break
    else:
        list1.append(i)
if 1 in list1:
    list1.remove(1)
print(sum(list1))