#include <stdio.h>
#include <math.h>
int prime(int a,int b)
{
int count=1;
int flag=0;
int sum=0;
int i=2,j=0;
while(count<=b)
{
i++;
int tmp=(int)sqrt(i);
for(j=2;j<=(tmp>2?tmp:2);j++)
{
flag=1;
if(i%j==0)
{ flag=0;
break;
}
}
if(flag==1)
{ count++;
if(count>=a&&count!=1&&count<=b)
sum +=i;
}
}
if(a==1) sum+=2;
return sum;
}
int main(int argc, char* argv[])
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d\n",prime(a,b));
return 0;
}
#include <math.h>
int prime(int a,int b)
{
int count=1;
int flag=0;
int sum=0;
int i=2,j=0;
while(count<=b)
{
i++;
int tmp=(int)sqrt(i);
for(j=2;j<=(tmp>2?tmp:2);j++)
{
flag=1;
if(i%j==0)
{ flag=0;
break;
}
}
if(flag==1)
{ count++;
if(count>=a&&count!=1&&count<=b)
sum +=i;
}
}
if(a==1) sum+=2;
return sum;
}
int main(int argc, char* argv[])
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d\n",prime(a,b));
return 0;
}