#include<stdio.h>
int main()
{
	int n, m;
	scanf("%d %d", &n, &m); 
	int i;
	int sum = 0;
	int count = 0;
	for(i = 2; count<=m; i++)
	{
		int j;
		int isPrime = 1;
		
		for(j = 2; j < i; j++)
		{
			if(i%j==0)
			{
				isPrime = 0;
				break;
			}
		}
		if(isPrime == 1)
		{
			count++;
			if(count>=n&&count<=m)
			{
			 	sum += i;
			}
		}
	}
	printf("%d\n", sum);
		
	return 0;
}