l,r=list(map(int,input().split()))
def judge_num(n):
    if n==2:
        return True
    else:
        for i in range(2,n):
            if n%i==0:
                return False
                break
            else:
                continue
    return True
cnt=0
for i in range(l,r+1):
    if judge_num(i):
        cnt+=i 
    else:
        continue
print(cnt)